Hi,
I have a form with 2 radio buttons (Full / Limited)
and 3 input fields (A, B and C) with validate:“NotEmpty” option.
When the radio button “Limited” is selected, input field “C” is hidden.
How can I know the “status” of this input file ? (e.g. Visible or Hidden) to program my own validation rule ?
Thanks
Andrei
#2
Hello,
You can add custom validate function for “C” field:
{type: “input”, name: “C”, validate: function(value){ myForm.isItemHidden(“C”) {…} else {…} }, …}
Hi,
can’t make it work like that…
That’s what I’ve done:
in formData (loaded by doOnLoad() function):
.../...
{ type:"input", name:"C" , label:"Enter C:" , validate:"isNotEmpty_C" }
.../...
And after the doOnLoad() function, I wrote my custom validation rule :
function isNumeric_ofr_int(value) {
if(myForm.isItemHidden("block_ref_ofr_full")) {return true;}
else { return dhtmlxValidation.isValidInteger(value) }
}
Thanks for your help
Sorry, I paste the wrong function.
Here the correct one
function isNotEmpty_C(value) {
if(myForm.isItemHidden("C")) {return true;}
else { return dhtmlxValidation.isNotEmpty(value) }
}
Merry Christmas
Andrei
#5
Hello
Please check attached demo
40.zip (31.5 KB)