Aug 26th, 2011, 1:45 PM
Hi egeller,
Good question. The conditional logic for the RSV library is REALLY basic. I just added it because simple "if A=X then validate B" logic was common and wanted to cover that scenario with some simple syntax. In your case, it's a bit more complex so you'll need to use a custom function instead. For that, try something like this:
You will need to replace the if conditions with whatever code makes sense, depending on the field types. Sorry - that will take a little JS knowledge, but feel free to post back if you're not sure about it.
Also the return statement will need to return the c1_medications DOM element as the first parameter.
For more info, check out the "Custom Validation Rules" page in the help doc:
http://www.benjaminkeen.com/software/rsv/standalone/
Good luck!
- Ben
Good question. The conditional logic for the RSV library is REALLY basic. I just added it because simple "if A=X then validate B" logic was common and wanted to cover that scenario with some simple syntax. In your case, it's a bit more complex so you'll need to use a custom function instead. For that, try something like this:
Code:
rules.push("function,mycustomfunction");
function mycustomfunction() {
if ( ... c1_allergies=yes||c1_medical=yes||c1_medications=yes ... ) {
if ( ... c1_medications != "yes" ... ) {
return [[ *c1_medications DOM element * , "Please provide medical details."]];
}
}
return true;
}
You will need to replace the if conditions with whatever code makes sense, depending on the field types. Sorry - that will take a little JS knowledge, but feel free to post back if you're not sure about it.
Also the return statement will need to return the c1_medications DOM element as the first parameter.
For more info, check out the "Custom Validation Rules" page in the help doc:
http://www.benjaminkeen.com/software/rsv/standalone/
Good luck!
- Ben