The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.27 (Linux)
|
![]() |
Problem with initializing array in RSV in jQuery? - 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: Problem with initializing array in RSV in jQuery? (/showthread.php?tid=26771) |
Problem with initializing array in RSV in jQuery? - dethompsOWU - Jul 31st, 2017 I'm using the RSV jQuery plugin, so if this is the incorrect place to post this question, please let me know where I should take this inquiry. I have a very complicated form involving validation rules that change depending upon which radio button a user selects. It's all working fine except in the use-case scenario where someone "changes their mind" and clicks a different radio button. The rules change as expected and everything seems to work fine, but there appears to be some "bleed-through" of the validation rules from the earlier radio button selection. I only noticed this because one of the radio button selections has a larger overall set of rules than the other. When I choose the larger and then change to the smaller, it still validates against the larger's rules. I'm doing all this with a jQuery bind("change") if/else statement: PHP Code: $("[name=submissionType]").bind("change", function() { Basically, it's evaluating a particular radio button's value and then branching out via if/else to set the RSV instance displayType and rules settings and whatnot. Each branch has all of the validation rules that are needed, so in theory it should work (right?) After I select the radio button that says it is an event, then the validation rules for event "win" (since they're lengthier?), even if I later change the radio button to be a non-event. If my hunch about this is correct, then the fix should be for me to clear out the "rules" array somehow, but I've tried a half dozen different standard methods for array-clearing, as well as multiple different positions within the code (beyond the code that's mentioned above), but nothing seems to work. I thought that RSV would already clear out the rules array when its defined, but apparently that's not the case? Anyway, if anyone can provide any help with this, it would be greatly appreciated. It's one of those things that nobody noticed for nearly a year (I originally created this form last summer) but now that someone's found it, of course it has cropped up several times for various people. Doug Thompson Manager of Web and Electronic Communications Ohio Wesleyan University |