Hello,
I see in the forum that someone wants to make a medium complex validation
(multi numeric field that the sum must be 100 because it is a percentage)
complex validation can have an easy but not user friendly solution
the idea is to had a "complex validation" field (big textarea) in wich the user can write javascript (a LOB in database)
this javscript must have a return true or false value and the code written is inserted in a function
for exemple if we wants to make a very easy validation on question17
(this is an exemple and this is perhaps not the best way to check this)
if type a validation formula in the "complex validation" field
--
if (thisForm.question17.value == 5) {
return true
} else {
return false;
}
--
because the complexe validation field is not empty during the generation
it will genereate something like
<input type="text" name="question17">
<script>
function validate_question17{
var thisForm = document.form; // This must be generated to avoid error
//From complexe validation field
if (thisForm.question17.value == 5) {
return true
} else {
return false;
}
//
}
<script>
<script>
function formSubmitFunction(
var finalResult = true;
// for each question if there is a validation function
var questionResult = validate_question17();
if (!questionResult) {
alert('question17 has not been validated'
;
finalResult = false;
}
return finalResult ;
}
</script>
of course this is not absolutly perfect because if the generate html (name of form or name of question change there will be javascript issue)