0

I have form name as myForm with two elements dropdown and autocomplete() textbox. If an end-user selects the value on the dropdown and give a suggestions on the autocomplete (tokens) and click an apply button to get the search results matching our inputs.

My Screen Input : HTML Screen

My problem here is to retain the form values after submitting the form through jquery. My code is here:

$("#myForm").submit(function(){
    $('#myForm').attr("method","post");
    $('#myForm').attr('action','http://localhost:8080/LscaSearch/');
    $('#myForm').submit();
});

I wanted to retain the form values after submit the form. Any help on this?

4
  • You are using a normal post-back and not jQuery+Ajax (my bad, this is mad) :)... Forget retaining them client-side as the page is lost! They need to be returned from server-side (or switch to Ajax as Nikhil Talreja suggests). Commented Jun 17, 2014 at 11:14
  • does a custom object filled when formsubmit and fill its stringfied into a hidden field then retreive form items from this evaled stringfied object ?????? Commented Jun 17, 2014 at 11:17
  • What is your server technology? PHP? .Net? most support hidden value passing and serializing custom controls. Commented Jun 17, 2014 at 11:18
  • my server technology is JAVA. Commented Jun 17, 2014 at 11:23

1 Answer 1

1

You can use asynchronous form submission using jQuery AJAX. That way you can show the results on the same page without having to refresh it.

Sign up to request clarification or add additional context in comments.

2 Comments

I think I preferred when you had jQueasy :)
You really need to show a practical example as I suspect they don't know where to start with Ajax (or they would already be using it!)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.