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

cannot submit form #59

Closed
fdc1000 opened this issue Nov 4, 2013 · 7 comments
Closed

cannot submit form #59

fdc1000 opened this issue Nov 4, 2013 · 7 comments

Comments

@fdc1000
Copy link

fdc1000 commented Nov 4, 2013

I have tried for the past 3-4 hours to figure out how to submit a form after validation but could not do it. I cant believe its this hard to figure out. Could someone share a working example please.

Here is my code that does not work in case someone can glance at it.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>tester</title>
    <link href="lib/bootstrap-combined.min.css" rel="stylesheet">
    <script src="lib/jquery.min.js"></script>
    <script src="lib/bootstrap.min.js"></script>
    <script src="nod.js"></script>
</head>
<body>
<div style="width: 300px; margin:0px auto">
        <form id="myForm" action="nod.php" method="post">
            <h3 class="form-signin-heading">Please sign in</h3>
            <input type="text" name="username" id="UserID" placeholder="User Id">
            <input type="password" id="Password" name="password" placeholder="Password">
            <br>
            <button class="btn btn-primary" type="submit" name="submit">Login</button>
        </form>
</div>
<script>
var metrics = [
    [ '#UserID', 'presence', 'User ID is Required' ],
    [ '#Password', 'presence', 'Password is Required' ],
    [ '#Password', 'min-length:4', 'Must be at least 4 characters long' ]
];
 $( "#myForm" ).nod( metrics);
</script>

</body>
</html>
@chall8908
Copy link
Contributor

As far as I can tell, the form IS being submitted. See this fiddle for proof. The event is firing and, for all intents and purposes, the form is being submitted. As for why it's not sending you to "nod.php" I presently have no idea, but I will look into it.

EDIT: I've checked the entire codebase. I don't see anything that should prevent the form from being properly submitted. That said, I've been completely unsuccessful at actually making the damn thing submit. You may be able to use a hidden form that doesn't have Nod to perform the actual POSTing. It's highly non-ideal, but it should work. I'll be sure to make this a test case on the new version of Nod currently in dev.

@casperin
Copy link
Owner

Sorry fdc1000, I'm going to completely skip looking at this and focus on the rewrite. I hope you work(ed) it out. :-)

@kuronopro
Copy link

Remove the name="submit" from the submit button. That should make it work.

@chall8908
Copy link
Contributor

That fixed my fiddle. Do you know why that was causing problems @kuronopro? I've never encountered this before.

@fdc1000
Copy link
Author

fdc1000 commented Nov 27, 2013

Wow, that worked.

Looks like it will work as long as the name is not equal to submit, name=xsubmit works fine.

Thank you for the help and for nod.

From: Chris Hall [mailto:notifications@github.com]
Sent: Monday, November 25, 2013 9:58 AM
To: casperin/nod
Cc: fdc1000
Subject: Re: [nod] cannot submit form (#59)

That fixed my fiddle. Do you know why that was causing problems @kuronopro https://github.com/kuronopro ? I've never encountered this before.


Reply to this email directly or view it on GitHub #59 (comment) . https://github.com/notifications/beacon/-fFvK5b45eLlQUk4Te1ExsuzKlB6GJEk5kkwxxsP_pkQcffYiwA79RO0xMcrp3rD.gif

@awsfanatic
Copy link

Yep, solution proposed by @kuronopro totally worked.

@casperin
Copy link
Owner

casperin commented Dec 7, 2014

Happy that it was solved :-)

@casperin casperin closed this as completed Dec 7, 2014
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

5 participants