how to set an element to be required webmethods caf using javascript

223 views Asked by At

I want to set required=true of an input in caf webmethods using javascript.

this my code that I try to set required:

if (CAF.model('#{activePageBean.clientIds['dropDowntypeFlux']}').getValue() == 'expo'){
     CAF.model('#{activePageBean.clientIds['htmlInputMatricule']}').setAttribute("required", "true");
}

but it does not work.

1

There are 1 answers

0
Christopher Gruen On

Try using CAF.model().element to get the original HTML Element:

if (CAF.model('#{activePageBean.clientIds['dropDowntypeFlux']}').element.getValue() == 'expo'){
 CAF.model('#activePageBean.clientIds['htmlInputMatricule']}').element.setAttribute("required", "true");
}

With CAF.model() you are using a JavaScript CAF Object with other features.