This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Jay-SmokersChoiceUSA
Jay-SmokersChoiceUSA

I created a custom theme with Bootstrap and have a contact us page with a basic form. The Ajax validation works fine but I can not find a way to add the default Bootstrap"has-error" class to the parent "input-group".

Is there an easy way to accomplish this without custom JS?

Last updated

Jay-SmokersChoiceUSA
Jay-SmokersChoiceUSA

@daftpunk helped me with this and the solution for now is a bit of jQuery

` $(window).on('ajaxInvalidField', function(event, fieldElement, fieldName, errorMsg, isFirst) { $(fieldElement).closest('.input-group').addClass('has-error'); });

$(document).on('ajaxPromise', '[data-request]', function() { $('.has-error').removeClass('has-error'); }); `

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.