Hi,
I have a scenario where I would have to add a specific CSS to an input field conditionally .
How can we get the access of input fields of a field editor ( I haven’t found anything like uniqueID on field properties for a field ) in javascript snippet to add CSS class ?
a few ways to do this. The easiest is probably a custom field renderer, like this:
var $ = skuid.$, field=arguments[0], value=arguments[1];
if (SOME CONDITION){
field.element.addClass(‘myCSSclass’);
}
skuid.ui.fieldRenderersrfield.metadata.displaytype]field.mode;
Hey Matt,
Thanks for your quick response!
But what I am trying to achieve here is , I have a button “Submit” , when a user click on this , this would make a call to some APEX remote function to validate the address entered , if I get success response , I have to add green checkmarks for these fields to show user this field is having corrected address value, if not add error mark to field to show it’s having incorrect address value.
For such cases, how could I get to access that field and add those CSS dynamically.
Appreciate your help!
KVin,
A couple ways to handle this. Perhaps the easiest is to just add a class to your field in the builder. For example, give your field a class called ‘test-class’. Then you could run javascript like this to select the DOM element for that field and add another class to it:
skuid.$('.test-class').removeClass('error-mark-class').addClass('green-checkmark-class');
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.