As described in my heading, I am having a problem with the Validation on Fields that are in my Collapsed Accordion sections. I have found MANY questions around this, but none work for me, or I am not quite understanding how it all works, so even though this is to be viewed as a duplicate question, it is not as none of the others have helped.
I have 4 sections :
So when I click the create then the Project Name Specifies that it is missing, however NOT for any of the collapsed sections.
I have tried :
$('#ticketForm').validate().settings.ignore = []
Which does not work. When I click create, then its as if the screen is doing a postback and anything I typed in is removed and returns to the first accordion section.
I have tried plenty other scripts that make no sense to me :( that others have said works, but I either get an error on a section that "does not exist", such as :
$(document).ready(function() {
$("#accordion").accordion({
autoHeight: false,
navigation: true,
});
$("#ticketForm").validate({
rules: {
page_title: "required",
seo_url: "required",
AccordionField: {
required: true
}
},
ignore: [],
messages: {
page_title: "Please enter a page title",
seo_url: "Please enter a valid name"
}
});
});
The error I get is that .accordion does not exist - or it does the same as I mentioned(Page does what looks like a postback etc etc.)
I have tried this as well, which give no error, but it doesnt work :
$(document).ready(function () {
$('#ticketForm').validate({
ignore: ":hidden"
});
});
I have tried placing <form id="ticketForm">
before and after my @using (Html.BeginForm())
, thinking it might makea difference, but has no effect.
Please could someone help.
Thank you!