|
Re: Processing forms without sacrificing navigation: msg#00014php.tcphp
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Geoffrey R. Thompson wrote: | This is really more an HTML question than a PHP question, but - | | I have a site that gathers a lot of information through multiple user | interactions. I have successfully built a 'wizard' which uses forms to | gather this data initially. Now, I want to allow the user to edit sections | of the data, while still being able to navigate freely to other areas of the | site. But, if a user clicks on a link in the main navigation for a | different page in the site, I want to harvest/process any changes in the | form PRIOR to going to the new page. Unfortunately, the form data is not | available if they click a link vs. hitting the submit button. | | I do not want to throw out the site navigation when a user is updating form | data, so I'm thinking of putting a hidden input field on the form to store | 'link' navigation info, and then rather than having straight navigation | anchors of the <a href="newpage.php">NewPage</a> variety, having the anchor | invoke a script, which will update the hidden field with the link info, and | then force a form submit() so that the data on the form can be processed. | Then, the php page processing the form would just pick up the link info from | the hidden field when it is done, and redirect there. | | This seems hoaky, but I can't think of a better way to accomplish this. I | was hoping someone here has done something similar, and has a better idea. | | Any ideas/suggestions would be appreciated. I had done something similar to this quite a ways back. What I ended up doing was have a javascript function that executed onload of the body. What it did was go through all the navigation links in the document, and add an onclick event that used a document.write to add two hidden fields to the form, then submit it. The first field was the href of the link that was clicked, and the second was the data that had been changed in the form before the link click. The form's action script looked for the hidden data input. If found, it processed/updated, and then used the header function to redirect the user to the second hidden value (the href of the link). There was a lot of debugging involved in setting it up, but once I got it working, I didn't have many problems at all. Of course, it didn't work for those who had js disabled, but in that case, they only lost the information that they didn't submit. I'm thinking this is what you are describing, but I may be misunderstanding what you are trying to accomplish... I've been known to do that - especially recently! ;) - -- Justin Koivisto - justin-72EOUSqB708AvxtiuMwx3w@xxxxxxxxxxxxxxxx http://www.koivi.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (MingW32) iD8DBQFCOfh9m2SxQ7JEbpoRAqt/AJ9RkY4uN36XFJeQFSkiNvaxI55CtQCcDpuA 2Mvr+CnthFqXXpaN33B1AC0= =2j0/ -----END PGP SIGNATURE----- |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Processing forms without sacrificing navigation: 00014, Geoffrey R. Thompson |
|---|---|
| Next by Date: | RE: OT: Collaboration/Demonstration software.: 00014, D'Arcy, Hamlet |
| Previous by Thread: | Processing forms without sacrificing navigationi: 00014, Geoffrey R. Thompson |
| Next by Thread: | Re: PHP Regular expression help: 00014, Daniel J. Post |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |