We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12766
    • 2 Posts
    Hi there all MODx experts smiley

    I’m developing a site and I need a feature where people enter their feedback from holidays around the world. The feedback must include: Name, E-mail, Message, Attach a photo. I think I could use the Jot snippet but I can’t find a way to add a custom browse image for people to attach their photo(Attach a photo) along with the Name, E-mail, Message. Is this possible with Jot? If not what kind of solution should I look for?

    Also I need to have moderation of posts which Jot includes and that is why I turned my attention to this exact snippet for the job to get done.

    Thanks all wink
    • Have this code in a file (assets/js/imagebrowser.js); make sure to edit the ServerPath parameter of the OpenServerBrowser call near the bottom to have your correct full path to your assets folder.
      function OpenServerBrowser(url, width, height ) {
      	var iLeft = (screen.width  - width) / 2 ;
      	var iTop  = (screen.height - height) / 2 ;
      
      	var sOptions = 'toolbar=no,status=no,resizable=yes,dependent=yes' ;
      	sOptions += ',width=' + width ;
      	sOptions += ',height=' + height ;
      	sOptions += ',left=' + iLeft ;
      	sOptions += ',top=' + iTop ;
      
      	var oWindow = window.open( url, 'FCKBrowseWindow', sOptions ) ;
      }			
      function BrowseServer(jotId) {
                      window.jotId = jotId;
      	var w = screen.width * 0.7;
      	var h = screen.height * 0.7;
      	OpenServerBrowser('/manager/media/browser/mcpuk/browser.html?Type=images&Connector=/manager/media/browser/mcpuk/connectors/php/connector.php&ServerPath=/path/to/public_html/assets/', w, h);
      }
      
      function SetUrl(url, width, height, alt){
      	document.getElementById('jotImage'+window.jotId).value = url;
      }


      and include it somewhere in your template or at the beginning of your document content (before the Jot call)
      <script type="text/javascript" src="assets/js/imagebrowser.js"></script>


      In your Jot form tpl:
      		<label for="jotImage[+jot.id+]">Image:<br />
      			<input tabindex="[+jot.seed:math=`?+6`+]" name="image" type="text" size="20" value="[+form.field.custom.image:esc+]" id="jotImage[+jot.id+]" /><input type="button" value="Select Image" onclick="BrowseServer('[+jot.id+]')" />
      		</label><br />


        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 12766
        • 2 Posts
        Thanks for the help but this code doesn’t work sad It requires visitors to log in if they want to upload an image. Otherwise the image browser won’t work. Any suggestions?
        • try the Enable File Browser option in the site configuration, in the Interface and Features tab.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org