formnovalidate and required fields

User 709272 Photo


Registered User
1 post

I have a form with some required text fields, and I want the user to be able to clear the form and start over.
Before using Form Builder I accomplished this by inserting a Clear button with that button's formnovalidate="formnovalidate". With Form Builder, this does not work. True, a required field with improperly formatted text be ignored, but if it is completely empty, the form is not submitted and the script points to the empty field.
Is there a work-around for this?
User 187934 Photo


Senior Advisor
20,239 posts

Hi Thaddeus,
Try this.
Add a checkbox and name it reset
Then paste this into an html element in to your form.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>
//ver 1
var jQ = $.noConflict(true);
jQ( document ).ready(function() {
jQ('input').click(function() {
if (jQ('input[name="reset[]"]').is(':checked')) {
jQ('form')[0].reset();
}
});
});
</script>
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.