Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jul 12, 2012 03:57 PM by Shikha Nechlani
Jul 02, 2012 09:59 PM|LINK
I have a view that has a form and a submit button in that form.
When I click the button, the form is posted to the controller/method in the form's action, and the view is redirected to the view in that controller method. All that is good.
Now I need to add links to the view and onclicking one of the links post the form.
I use jquery to submit the form (I have also fired the button click with jQuery)
I do this and the form is posted to the correct controller/method but the view is NOT redirected.
The only difference I see between the two approaches is that the button click is a user action and the call to form submit is a jquery action.
Does anybody know what might be going on here
Jul 02, 2012 11:30 PM|LINK
Jul 03, 2012 12:02 AM|LINK
Please look at the below article to style the button.
Submit button is the best way to handle the form post, by this way you need not to worry about enter key to submit the form.
Jul 03, 2012 12:45 AM|LINK
as I said "the form is posted to the correct controller/method", so yes it is Posting and the method does have [HttpPost] attribute
Clicking the button posts.
I know this is posting because there is also a text box and a hidden field(that gets the value of the clicked link) that appear on:
The Posting is not my issue, it is the redirection to the new view.
Jul 03, 2012 01:05 AM|LINK
Can you post the jquery here ? to suggest some alternative. Also you might was to look at below discussion.
Jul 03, 2012 01:49 AM|LINK
Yes I could do that
But let me clarify.
I need 2 sets of controls that post the form:
I know that "Submit button is the best way to handle the form post" and that is what I am trying to do!!
The button is a submit button, so when the user(me) clicks it, it posts and redirects to the correct view.
But when the user(me again) clicks one of the licks, it posts ok but does not redirect away from that view.
the event that handles the Link onClick:
The button click posts and redirects the to the desired view.
Any clues on why??
Jul 03, 2012 01:55 AM|LINK
Please see my other third post
I am not using ajax on this view, nor do I wish to. Ajax is for getting data back to the SAME view. I want to go to ANOTHER view!!
Jul 09, 2012 01:40 PM|LINK
Did you include the jquery-x.x.x.js file in your View? If not, please add it.
Hope this helpful
Jul 09, 2012 11:17 PM|LINK
As I have pointed out the submit is working and as you can se it is a jquery call so yep I have a reference to a jquery library
Here are my js "links"
As you can see the jquery library is coming from Telerik so that may be an issue, but it is functioning well for all our other jquery operations(too many to list here)
Jul 10, 2012 03:23 AM|LINK