Checking if client side field exists

Hi,

Does anyone know how I can check through client side code if a field exists using CAF.Model methods? Similar to checking typeof var == undefined in JavaScript?

hi
on the client side you can check for the existence of HTML elements via their ID. Something like:

var myField = CAF.model('#{activePageBean.clientIds['myField']}');
if (myField == null) {
alert('It does not exist');
}

This only makes sense if you have defined this control with id “myField” in your view and toggled its rendering based on some other condition (if its value is empty, or if some other value is empty…).

hope this helps
Javier