Forum Moderators: open

Message Too Old, No Replies

Form submit without going to page mentioned in action?

Submitting form leads to process page, but I'd like to stay with form

         

nuna

11:28 am on Nov 18, 2004 (gmt 0)

10+ Year Member



At the office we have an internal form web page with some hundreds of lines and checkboxes. The checkboxes have to be clicked one-by-one (15 every time) and then the submit button has to be clicked. Clicking submit leads to a new page showing that the 15 lines are processed. After a 10 minutes delay you click back (and renew - F5) and start all over.

Of course I want to automate that with Javascript, but I can't change the page on the server. I tried to do it this way:
- I copy the page to my local disk. Relative URLs are changed in absolute.
- A cookie saves a counter to know which checkboxes have been processed yet.
- Another JS function "checks" the following 15 boxes and submit the page.
- And here is where the problem shows up. In the form tag, the action attribute shows the URL to a perl script on the server. This script shows a new page, mentioning that the 15 lines are processed (kind of thank you page). I'd like to submit and process those items, but then return to the original page, where an automatic refresh after 10 minutes would continue with the next 15 items (cookies and checking functions...).

Does anyone have any experience with this? I know it's not something you use for a own-managed website, for sure there you have at least access at your server, and here I haven't.

kaled

12:34 pm on Nov 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I presume the action page says something like "your data was sent correctly".

In this case, all that is required is to set the target attribute of the form to either "_blank" or "ANameForTheWindow"

If the former, the action page will open in a new window each time the form is submitted, if the latter, the action page will be displayed in the same window each time. If no such named window exists, a new one is created.

Alternatively, the action page could use javascript to go back (using the history object I think).

You could also use javascript on the action page to close the window after a few seconds.

You could also ensure that the action page is somehow invalid so that it is not displayed - there may be a clean way to do this but the user would still not see a confirmation message.

Kaled.

nuna

1:03 pm on Nov 18, 2004 (gmt 0)

10+ Year Member



Thanks Kaled,

Indeed, the action page says something like "your data is processed correctly". The target attribute with "ANameForTheWindow" will do the trick.

For the other solutions: the "_blank" would open too much (dozens...) browser windows and I have no rights to change the action page.

But, as said, your "ANameForTheWindow" solution will do the trick. Sorry, digging into Javascript kept me away from clear HTML thinking ;)

nuna