I have a sensitive a boolean field that cannot be display with a label. I;m using a custom template to display an image. When it’s clicked, it changes to another image. This is fine. But at the same time, I want to toggle the actual field on the model to true/false.
// this code only runs once. If I click it once, it takes the new css class and prints 1. On second clicks, the function is not entered. If I remove the updateRow, the function is entered fine. 1 will be printed. Any ideas why??
(function(skuid){ var $ = skuid.$; $(function(){
var contactModel = skuid.$M(‘Contact’),
contactRow = contactModel.getFirstRow(),
hiddenFieldChecked = contactModel.getFieldValue( contactRow, ‘hiddenfield__c’ );
$(‘.customIcon’).click(function(event) {
alert(1);
$( this ).closest(‘.nx-fieldtext’).toggleClass(‘customIconTextColor’);
hiddenFieldChecked = hiddenFieldChecked ?false:true;
contactModel.updateRow({Id:contactRow.Id}, {hiddenfield__c: hiddenFieldChecked });
});
});
})(skuid);
Question
Click event only runs once when updateRow is added
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.