This is a migrated thread and some comments may be shown as answers.

Send form data to server

1 Answer 544 Views
Validation
This is a migrated thread and some comments may be shown as answers.
Koen
Top achievements
Rank 1
Koen asked on 29 Oct 2012, 08:35 AM
L.S.

Using the demo on

http://demos.kendoui.com/web/validator/index.html

How do I send the form data to the server (preferably as json, but anything goes.) I assume that the magic must happen in:

$("button").click(function() {
  if (validator.validate()) {
    status.text("Hooray! Your tickets has been booked!").addClass("valid");
// right, so here we can save, post, the form data? But how?
// something like save("http://address.to/server/path/","json","POST") ?
} else { status.text("Oops! There is invalid data in the form.").addClass("invalid"); } });

kind regards, Koen

1 Answer, 1 is accepted

Sort by
0
Koen
Top achievements
Rank 1
answered on 29 Oct 2012, 09:49 AM
Right ... old school form action:

<form action="http://address.to/server/path" method="post">
    <ul>
        <li>
            <label>Label</label>
            <input ... />
        </li>
        ...
    </ul>
</form>

If the form validates, it is automatically send to the action. So all you need to do is enclose the form with the actual <form> tags.

If I find out how to send the form data simply as a json, I'll let you know.

(Sure: action="javascript:doAjaxHere(this);" will probably do the job, but that is not an easy json way. There's got to be a simple kendo solution.)
Tags
Validation
Asked by
Koen
Top achievements
Rank 1
Answers by
Koen
Top achievements
Rank 1
Share this question
or