I have a CGI-style web application using static HTML (an SAS IntrNet app) that submits a form to the server and then gets a report back.
I want to change it so that the output is opened in a separate window which gets created using JavaScript.
That means I need to grab all the form selections and hidden fields and pass them to the new window, plug them into a new form and submit to the server.
What's the best way to do this? Is this the most efficient way?
1. Loop through the form using jQuery and populate a querystring variable with all the form elements' names & values. (Note: Some are multi-option select boxes.)
2. Open up the new window with that querystring.
3. Loop through that querystring and dynamically add a hidden field to the window's form for each element.
4. Submit the form from the window to the server.
Are there any gotchas I need to be aware of? Can hidden fields take the place of multiple-value select boxes, for example?
I've figured out how to loop through the form using jQuery and create the querystring. Now, I just want to make sure the final step--impersonating the original form--is doable, too.
Thanks.
I want to change it so that the output is opened in a separate window which gets created using JavaScript.
That means I need to grab all the form selections and hidden fields and pass them to the new window, plug them into a new form and submit to the server.
What's the best way to do this? Is this the most efficient way?
1. Loop through the form using jQuery and populate a querystring variable with all the form elements' names & values. (Note: Some are multi-option select boxes.)
2. Open up the new window with that querystring.
3. Loop through that querystring and dynamically add a hidden field to the window's form for each element.
4. Submit the form from the window to the server.
Are there any gotchas I need to be aware of? Can hidden fields take the place of multiple-value select boxes, for example?
I've figured out how to loop through the form using jQuery and create the querystring. Now, I just want to make sure the final step--impersonating the original form--is doable, too.
Thanks.
Comment