I have gotten a page close handler to work with a warning on a field that we want to require. However, we only want to require this field for patients over 13 years old. Therefore, I have created visibility fields and programmed the field differently in each. However, I am still getting that 'required' warning on young kids. I have confirmed that the right field is in the right visibility. What might I be missing?
Thank you for any assistance you can give me!
You need to have the age criteria in the page close handler too, probably the same code that is in your visibility region for age
Thanks! I tried adding
patient._ageinmonths < 156 (and vice versa)
to the 'Use enable expression' section. I even tried adding it to the suppression condition field. Nothing changed in the way the form acted. What might I be doing wrong? Thank you very much!
If you have an 'if-then' statement in your page close handler you want it there, so 'if patient._ageinmonths > 156 then' ...if required field is still blank then fill it out.
The enable expression will activate a field if the condition is true, its like an alternative to a visibility region. It will display the field all the time but will appear grayed out if the condition is false. The suppression condition is for suppressing the text translation. You can use that if, for example, you only want a form to translate to the text if a check box is marked.
And also remember that the page close handler will execute when you navigate away from the PAGE, not a specific field within the page. Therefore, in the page close handler, you would need something like this:
if patient._ageinmonths<156 then useryesno("This patient is under the age of 13. Are you sure you want to xyz")
else ""
endif