About this topic

  • Posted by sommernyte 5 months ago. There are 6 posts. The latest reply is from byron.
  • This topic is resolved
  1. I noticed in another thread, you mentioned using JS to make fields required. I know how to do that, but what I'm not sure is how you'd tell the form onsubmit="return validate_form(this);" when the plugin is generating the <form> tags? I don't really want to modify the plugin itself if I don't have to, as those edits inevitably get lost during upgrades.

    Thank you!

  2. Hmmm, I was thinking it was a matter of using the HTML in place of the [submit] short tag and then adding onclick to validate, but it doesn't seem to be working. Could be bad, script though... Any advice in the meantime is appreciated! :)

  3. Yep, it was just bad JavaScript!

    If anyone else is trying to figure it out, you can use the Custom Forms to create your upload form and include your JavaScript validation code there. Then, instead of using the [submit] short tag to create the submit button, grab the HTML generated by the plugin outputs (you can do this by using the short tag first, going to a live page and then viewing the code). Then just add onclick to that tag in your Custom Form to have it run the JS validation. :)

  4. Thanks Sommer!

    That's a great suggestion. It is very cool when folks are figuring out how to make PhotoSmash better.

    Cheers,
    Byron

  5. Perhaps in a future version, you could have a field somewhere to enter custom JS code, and then a checkbox somewhere where a user could check "Yes" to use their custom JS on form submit. :)

  6. Good suggestion. What might also work would be a user exit in the submit code that lets you run some custom code and stop the submission on false return.

    Cheers,
    Byron

RSS feed for this topic

Reply

You must log in to post.