Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inside a asp.net webfrom you can't have many forms #115

Open
abkmrad opened this issue Jan 16, 2017 · 1 comment
Open

inside a asp.net webfrom you can't have many forms #115

abkmrad opened this issue Jan 16, 2017 · 1 comment

Comments

@abkmrad
Copy link

abkmrad commented Jan 16, 2017

while i 'am able to select the whole form inside a asp.net webform i'am not able to create div with input and check if it's dirty because work only if you select a form tag
for example in asp.net web form page i have

<form id="form1" runat="server">
<div id="myform">
            <div>
                <label for="exampleInputName2">Name</label>
                <input type="text"  id="exampleInputName2" placeholder="Jane Doe">
            </div>
            <div>
                <label for="exampleInputEmail2">Email</label>
                <input type="email" id="exampleInputEmail2" placeholder="[email protected]">
            </div>
</div>
</form>

with this scenario how can i select the div with id myform

@NightOwl888
Copy link
Collaborator

Since it is the form that Dirty Forms must attach to, you must use the one form that is on the page. The simplest way to do it with ASP.NET is just to use the form selector.

$('form').dirtyForms();

This would normally select every form, but since you only have one this is how you can select it without hard-coding the name into your JavaScript file.

As for "selecting a div within the form", it is unclear what you mean. You can ignore one of the divs by following the ignoring things documentation. But the default behavior will mark the form dirty if either of your text boxes have been changed after the page loads, and will pop up the dialog if you try to navigate away without submitting the form.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants