FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to make Reset button reset RSV error field highlighting and error messages DIV?
#1
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
Reply
#2
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
Reply
#3
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,
Reply
#4
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() {
  $("#reset_button_id").bind("click", function() {
    $(".theErrorClass").removeClass("theErrorClass");
  });
});

Let me know if you have any trouble with it!

- Ben
Reply
#5
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.
Reply
#6
Ah yes! Sorry, I should have thought of that.

Glad it's working now!

- Ben
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)