I have JS line
document.getElementById(element).required=true;
How do I make it work in Oracle APEX?
I have a form with select list that has values Yes/No. If a value is "Yes", 2 more text fields appear. I have done it by making dynamic action (when item is changed and gets specific value) but there was no option to set required values, so I tried to "Execute JS code".
But JS line above didn't work.
I have JS line
document.getElementById(element).required=true;
How do I make it work in Oracle APEX?
I have a form with select list that has values Yes/No. If a value is "Yes", 2 more text fields appear. I have done it by making dynamic action (when item is changed and gets specific value) but there was no option to set required values, so I tried to "Execute JS code".
But JS line above didn't work.
Share Improve this question asked Sep 30, 2014 at 12:00 Mr.PMr.P 51 gold badge2 silver badges3 bronze badges 1- Which version of Apex are you using? – Ian Carpenter Commented Sep 30, 2014 at 13:13
2 Answers
Reset to default 3You must add two conditionals validations for those text fields.
- Set field template as required, but leave it "Is Required" as "No".
- Add a validation for each field and make it "Conditional" setting it condition type to "Value of Item / Column in Expression 1 = Expression 2". On "Expression 1" set your select Name and "Expression 2" to desired value. Add Condition Validation Level Validation Type Condition
When you make an item required it is always required when you submit the form. You'll have to resort to page validations to check if it has a value in specific cases.