We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3493
    • 66 Posts
    Jolly evening, good people!

    I’m new to Jot, and I’m having major problems using custom fields with this snippet... I just don’t get how it works...

    Here’s my snippet call:
    [[Jot? &subscribe=`0` &pagination=`10` &customfields=`where,status,url` &tplForm=`SVN_newBug` &tplComments=`SVN_posts`]]

    Here’s my SVN_newBug template, which holds the post form:
    <a name="jf[+jot.link.id+]"></a>
    <form method="post" action="[+form.action:esc+]#jf[+jot.link.id+]" class="jot-form">
    	<fieldset>
    	<input name="JotForm" type="hidden" value="[+jot.id+]" />
    	<input name="JotNow" type="hidden" value="[+jot.seed+]" />
    	<input name="parent" type="hidden" value="[+form.field.parent+]" />
    	
    	[+form.moderation:is=`1`:then=`
    		<div class="jot-row">
    			<b>Skrevet:</b> [+form.field.createdon:date=`%a %B %d, %Y at %H:%M`+]<br />
    			<b>Skrevet av :</b> [+form.field.createdby:userinfo=`username`:ifempty=`[+jot.guestname+]`+]
    			<br />
    			<b>Publisert:</b> [+form.field.published:select=`0=No&1=Yes`+]<br />
    			[+form.field.publishedon:gt=`0`:then=`
    				<b>Published on:</b> [+form.field.publishedon:date=`%a %B %d, %Y at %H:%M`+]<br />
    				<b>Publisert av:</b> [+form.field.publishedby:userinfo=`username`:ifempty=` - `+]<br />
    			`+]
    			[+form.field.editedon:gt=`0`:then=`
    				<b>Edited on:</b> [+form.field.editedon:date=`%a %B %d, %Y at %H:%M`+]<br />
    				<b>Senere redigert av:</b> [+form.field.editedby:userinfo=`username`:ifempty=` -`+]<br />
    			`+]
    		</div>
    	`:strip+]
    	
    		<label for="name">Ditt brukernavn:<br />
    		<input tabindex="[+jot.seed:math=`?+1`+]" name="name" type="text" size="40" value="[+form.field.custom.name:esc+]" />
    		</label>
    	<label for="title">Kort feilbeskrivelse:<br />
    	<input tabindex="[+jot.seed:math=`?+2`+]" name="title" type="text" size="40" value="[+form.field.custom.title:esc+]" />
    	</label>
    	<label for="where">Hvor oppsto feilen:<br />
    <select tabindex="[+jot.seed:math=`?+3`+]" name="where">
      <option value="Ordinære nettsider">Ordinære nettsider</option>
      <option value="Forum">Forum</option>
      <option value="Blogger">Blogger</option>
      <option value="Galleri">Galleri</option>
    </select>
    	</label>
    	<label for="url">Webadresse:<br />
    	<input tabindex="[+jot.seed:math=`?+4`+]" name="url" type="text" size="40" value="[+form.field.custom.url:esc+]" />
    	</label>
    	<label for="content">Utvidet feilbeskrivelse :<br />
    	<textarea tabindex="[+jot.seed:math=`?+5`+]" name="content" cols="50" rows="8">[+form.field.custom.content:esc+]</textarea>
    	</label>
    
    [+form.moderation:is=`0`:then=`
    	<input name="status" type="hidden" value="Åpen" />
    `:strip+]
    
    [+form.moderation:is=`1`:then=`
    	<label for="status">Status:<br />
    	<select tabindex="[+jot.seed:math=`?+6`+]" name="status">
      <option value="Åpen!">Åpen!</option>
      <option value="Under verifisering">Under verifisering</option>
      <option value="Under utbedring">Under utbedring</option>
      <option value="Fullført og lukket">Fullført og lukket</option>
    </select>
    	</label>
    `:strip+]
    	<br />
    	
      [+jot.captcha:is=`1`:then=`
    		<div style="width:150px;margin-top: 5px;margin-bottom: 5px;"><a href="[+jot.link.current:esc+]"><img src="[(base_url)]manager/includes/veriword.php?rand=[+jot.seed+]" width="148" height="60" alt="If you have trouble reading the code, click on the code itself to generate a new random code." style="border: 1px solid #003399" /></a></div>
    		Sikkerhetskode (CAPCHA) :<br />
    		<input type="text" name="vericode" style="width:150px;" size="20" /> 
    	`:strip+]
    	
    	<div style="float:right;width: 100px;"></div>
    	<input tabindex="[+jot.seed:math=`?+5`+]" name="submit" type="submit" value="[+form.edit:is=`1`:then=`Legg til feilen`:else=`Legg til feilen`+]" />
    	[+form.edit:is=`1`:then=`
    		<input tabindex="[+jot.seed:math=`?+5`+]" name="submit" type="submit" value="Avbryt" onclick="history.go(-1);return false;" />
    	`+] 
    	</fieldset>
    </form>


    I’ll give you the SVN_posts too:
    <a name="jc[+jot.link.id+][+comment.id+]"></a>
    	<div class="jot-row [+chunk.rowclass+] [+comment.published:is=`0`:then=`jot-row-up`+]">
    	 <div class="jot-comment">
     		 
    		 <div class="jot-user">
    		 [+comment.createdby:isnt=`0`:then=`<b>`+][+comment.createdby:userinfo=`username`:ifempty=`[+comment.custom.name:ifempty=`[+jot.guestname+]`:esc+]`+][+comment.createdby:isnt=`0`:then=`</b>`+]
    		 <br />
    		 </div> 
    		
    		 <div class="jot-content">
    			 
    			 <div class="jot-posticon">
    					[+phx:userinfo=`lastlogin`:ifempty=`9999999999`:lt=`[+comment.createdon+]`:then=`
    				 <img src="[(base_url)]manager/media/style/MODx/images/icons/folder_page_add.gif" width="18" height="18" alt="New comment" border="0" />
    				 `:else=`
    				 <img src="[(base_url)]manager/media/style/MODx/images/icons/newdoc.gif" width="16" height="16" alt="Comment" border="0" />
    				 `:strip+]
    			 </div>		 
    			 
    			 <div class="jot-mod">
    			 [+jot.moderation.enabled:is=`1`:then=`
    				<a href="[+jot.link.delete:esc+][+jot.querykey.id+]=[+comment.id+]#jotmod[+jot.link.id+]" onclick="return confirm('Are you sure you wish to delete this comment?')" title="Delete Comment"><img src="[(base_url)]manager/media/style/MODx/images/icons/event3.gif" width="16" height="16" alt="Delete Comment" border="0" /></a>
    				[+comment.published:is=`0`:then=`
    				<a href="[+jot.link.publish:esc+][+jot.querykey.id+]=[+comment.id+]#jotmod[+jot.link.id+]" onclick="return confirm('Are you sure you wish to publish this comment?')" title="Publish Comment"><img src="[(base_url)]manager/media/style/MODx/images/icons/add.png" width="16" height="16" alt="Publish Comment" border="0" /></a>
    				`+]
    				[+comment.published:is=`1`:then=`
    				<a href="[+jot.link.unpublish:esc+][+jot.querykey.id+]=[+comment.id+]#jotmod[+jot.link.id+]" onclick="return confirm('Are you sure you wish to unpublish this comment?')" title="Unpublish Comment"><img src="[(base_url)]manager/media/style/MODx/images/icons/delete.png" width="16" height="16" alt="Unpublish Comment" border="0" /></a>
    				`+]
    			 `:strip+]
    			 [+jot.user.canedit:is=`1`:and:if=`[+comment.createdby+]`:is=`[+jot.user.id+]`:or:if=`[+jot.moderation.enabled+]`:is=`1`:then=`
    				 <a href="[+jot.link.edit:esc+][+jot.querykey.id+]=[+comment.id+]#jf[+jot.link.id+]" onclick="return confirm('Are you sure you wish to edit this comment?')" title="Edit Comment"><img src="[(base_url)]manager/media/style/MODx/images/icons/logging.gif" width="16" height="16" alt="Edit Comment" border="0" /></a>
       		 `:strip+]
    			 </div>	
    			  
    			 <span class="jot-subject">[+comment.title:limit:esc+]</span><br />
    			 <span class="jot-poster"><b>Feil-ID: [+comment.postnumber+] <br />Postet: [+comment.createdon:date=`%a %B %d, %Y, %H:%M:%S`+]</b></span>
    			 <hr />
    			 <div class="jot-message">
    			 	<p>Sted: [+comment.where:esc+] </p>
    			 	<p>URL: [+comment.url:esc+] </p>
    			 	<p><i>[+comment.content:wordwrap:esc:nl2br+]</i></p>
    				<p><font color="#990000" size="+2">Status: 	<b>[+comment.status:esc+]</b></font>
    			</div>
    			 <div class="jot-extra">
    			 [+comment.editedon:isnt=`0`:then=`
    			  <span class="jot-editby">Sist oppdatert: [+comment.editedon:date=`%B %d, %Y, %H:%M:%S`+] av [+comment.editedby:userinfo=`username`:ifempty=` * `+]</span>
    			   `+]</div>
    		 </div>	 
    	 </div>
    	</div>
    


    I think the main problem may be the way I’m calling the custom fields in SVN_posts, but I’m way out with this... Can anybody explain what I’ve done wrong? See, the custom fields appears in the form, but not in the posts. They’re just blank!

    Thanks!

    (ModX version: 0.9.5)
      • 3493
      • 66 Posts
      Hmh? Nobody knows how to use custom fields in Jot? Am I being way too stressed or is this a function that nobody have used? If so, I’ll try to figure it out on my own, and add an example in the WIKI... I’ll do that anyways by the way, but I honestly can’t get the deal with this!

      Anybody out there?
      (Echoes - Pink Floyd)
        • 6726
        • 7,075 Posts
        There sure is someone out there who knows the answer to your problem, but woosh that a long bit of code you posted there !

        I am sure someone will be able to help you here, but the first readers might have been put off by the bulk of code tongue
          .: COO - Commerce Guys - Community Driven Innovation :.


          MODx est l&#39;outil id
          • 3493
          • 66 Posts
          I guess you’re right rolleyes
          I’ve cut out the irrelevant parts of the code now, and cleaned the post up a bit... Either way, all I need now is really an explanation on how to use custom fields. If I get that part, I can probably fix my problem without any hassle at all smiley
            • 32712
            • 8 Posts
            I didn’t really look through your source too much, but i have been having difficulty with the Jot usage in general. But I think I am beginning to understand what is going on.
            I believe when you set "customfields" it’s only supposed to save the information for you. then, you have to bring that information into the the chunk that makes the post. i hope that helps.
              • 3493
              • 66 Posts
              Thanks, but I got that part grin
              In general, my question is:
              How do I put a custom field in the form, and how do I display it in the posts? Is there a special name I have to tag the input field / display variable with?
                • 32712
                • 8 Posts
                hehe. sorry. wasn’t sure what you meant. if i find answer, i will post it.

                dale
                  • 3493
                  • 66 Posts
                  Swell, dude smiley
                  Anybody else?
                    • 33337
                    • 3,975 Posts
                    Your question’s answer seems to be simple: http://wiki.modxcms.com/index.php/Jot#Custom_fields

                    You need to add the form bits yourself in the chunk, e.g.

                    <input name="where" type="text" size="40" value="[+form.field.custom.where:esc+]" />

                    Its a quick guess after reading the doc.... try it!

                    ... and for future posts, please use [ code ] [ / code ] tags instead of quote... (ofcourse without spaces)
                      Zaigham R - MODX Professional | Skype | Email | Twitter

                      Digging the interwebs for #MODX gems and bringing it to you. modx.link
                      • 3493
                      • 66 Posts
                      Your question’s answer seems to be simple: http://wiki.modxcms.com/index.php/Jot#Custom_fields
                      I can honestly say; no! I have followed the limited guidelines from your link (which I DID read before I posted anything here...), and it’s not working. I’ll promise to add a WIKI How-to on this when I understand it.

                      You need to add the form bits yourself in the chunk, e.g.

                      <input name="where" type="text" size="40" value="[+form.field.custom.where:esc+]" />
                      Thanks, but this is what I’ve tried to do... I replaced it now with your example, yet, it’s still a problem. I tried to see if it added any content to [+form.field.custom.where:esc+], but when I submit it and it reloads (like if it doesn’t validate), it’s empty.

                      Also, how do I call the variables in the post loop chunk?

                      Its a quick guess after reading the doc.... try it!
                      Mh... Can’t say I feel that way... huh

                      ... and for future posts, please use [ code ] [ / code ] tags instead of quote... (ofcourse without spaces)
                      Uups, my bad! Sorry about that embarrassed