The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.28 (Linux)
|
Conditional validation js format - 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: Conditional validation js format (/showthread.php?tid=2566) |
Conditional validation js format - P-Tron - Aug 21st, 2013 Hello all, I am hoping some one can point me in the right direction here. I have a form where I need to validate a field based on whether another field has been selected but I cant quite crack it as my jquery skills arent great. I have a checkbox named "home_loan", if a user checks it then they need to fill out a textbox field named "buynew". If someone coudl tell me how to modify this line to get it to work that would be fantastic. rules.push("required,home_loan,Please chose a loan type."); Cheers RE: Conditional validation js format - michatmaster7 - Aug 22nd, 2013 Yea, I'd like this, as well, but I don't think the included validation script was designed for this purpose. It can probably be done with a custom regex validation, but I'm no good with that, either. Actually, I've been trying to take it one step further and figure out how I can disable/enable a field depending on which of two radio buttons are currently selected. But I can't figure that out either, as I suspect it would require the page to be reloaded (an onClick even, for example) to go back and forth. Adding my two cents here to stay subscribed. RE: Conditional validation js format - P-Tron - Aug 22nd, 2013 ah I think it should be achievable it just needs some sort of "if" statement, which I don't know how to write |