I have an event listener on my html page so that when the value of a component changes, another component will become mandatory. But this only works if you change the value of the component, save the page and reload it
Is there a way to do this without having to save and reload the whole page?
@EventListener(targets="licensingStatus", events="onchange")
public void onLicenseStatusChange(IRequestCycle cycle){
....
}
EDIT:
can a function turn
<input jwcid="licensingApprovalDate@CustomDatePicker"/>
into this
<input jwcid="licensingApprovalDate@CustomDatePicker" validators="validators:maxDateToday"/>
If the component needs to be generated dynamically:
Simplest implementation is using
AJAX. You can have a listener for any component on your page, and when a change occurs, make anAJAXcall and make the other component appear.Else:
If the component already exists and has been made invisible initially and just needs to be made visible then you can have this code
in your listener.
EDIT:
If you just want the new field to be mandatory, you can create a check for it in javascript so that when you enter the submit button or whatever it is, the field is checked whether it is empty or not and if empty gives out a message to the user. Something like this: