-
Notifications
You must be signed in to change notification settings - Fork 30
Add triggering of events on show and hide #20
Comments
I would love this ability too. In the past I've had to use jQuery to toggle requirements based on visability but if this lib could do it that would be awesome +1 |
Hi, .conditionize({
'hideJS': false, // default true
'showHide': true, // default true
'clearOnHide': true, // default true
'toggleClass': ['required-field', 'is_visible'], // default undefined
'customHandler': function(is_met, $section) {
if (is_met) {
alert('The condition is met');
}
}
}); That would work for your case too, right? P.S. I am not sure that list of parameters should be exactly as in my example. I just wanted to show the idea. |
Yeah, I guess. Thanks for the suggestion. I was also thinking if eval() could be replaced. Not sure if there would be any security issues in this case. Where I use the script a person can just create the conditions themselves. Not sure what would happen if they hacked in some malicious code... |
Although it's a different issue, I absolutely agree. I thought of it recently. But for now, I do not know a better way to evaluate a condition. If you have something in mind, I would appreciate your suggestion. But let's proceed in another issue. |
By the way, your project seems very interesting. Can you share a link (if possible)? |
This issue is fixed in the conditionize2.js |
Hi there again,
I find it useful if some events would be triggered on the element on hiding and on showing. I am dealing with some validation and required fields (inside hidden sections) on the FE and BE side. So I need to toggle the required attribute depending if the section is shown or not.
I do not know how to do a PR, but this is basically what I would want/need:
The text was updated successfully, but these errors were encountered: