The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
![]() |
How to make Reset button reset RSV error field highlighting and error messages DIV? - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Modules / Other (https://forums.formtools.org/forumdisplay.php?fid=8) +--- Forum: Form Validation: JS + PHP (https://forums.formtools.org/forumdisplay.php?fid=18) +--- Thread: How to make Reset button reset RSV error field highlighting and error messages DIV? (/showthread.php?tid=1499) |
How to make Reset button reset RSV error field highlighting and error messages DIV? - dethompsOWU - Aug 3rd, 2011 I have a form with RSV scripting and whatnot, and I noticed that when I press the Reset button to reset the form, it doesn't have any impact on the visibility of the error messages nor on the color-coding of the fields that are in error. Presumably, I need to make a script that somehow resets the error messages and the color-coding on the error fields, but I'm having trouble figuring out what actually does that. Any help would be greatly appreciated. Thanks, Doug Thompson Manager of Web and Electronic Communications Ohio Wesleyan University RE: How to make Reset button reset RSV error field highlighting and error messages DIV? - Ben - Aug 4th, 2011 Hi Doug, Ah, for this you'd need to add a custom function. Do you have any JS libraries in the page (Prototype, jQuery, Mootools?) It's perfectly possible with "plain vanilla" javascript, but a library would make the code a lot simpler and shorter! Let me know and I'll write up a function. - Ben RE: How to make Reset button reset RSV error field highlighting and error messages DIV? - dethompsOWU - Aug 5th, 2011 I don't currently have any JS libraries on the page, but I use jQuery elsewhere on our site, so it wouldn't really be an issue for me to add that to the page if it would help. Thanks, RE: How to make Reset button reset RSV error field highlighting and error messages DIV? - Ben - Aug 5th, 2011 Hi Doug, Marvellous - that'll save some time! Here's the code. You'll need to replace "reset_button_id" with the ID of your reset button, and "theErrorClass" with whatever error class you're using. Code: $(function() { Let me know if you have any trouble with it! - Ben RE: How to make Reset button reset RSV error field highlighting and error messages DIV? - dethompsOWU - Aug 8th, 2011 Worked great, but only to remove the error coloring on the fields that have errors. So, since I'm using rsv.displayType="display-html", I added the following jQuery code to the function: $("#rsvErrors").hide(); and that seems to have done the trick on removing the box of error messages as well. RE: How to make Reset button reset RSV error field highlighting and error messages DIV? - Ben - Aug 8th, 2011 Ah yes! Sorry, I should have thought of that. Glad it's working now! - Ben |