1

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.

M.SAM SIM
  • 85
  • 1
  • 5

1 Answers1

1

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.