Closed Thread Icon

Topic awaiting preservation: Link to submit before going to it's destination? (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=22705" title="Pages that link to Topic awaiting preservation: Link to submit before going to it&amp;#039;s destination? (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Link to submit before going to it&#039;s destination? <span class="small">(Page 1 of 1)</span>\

 
PaulBM
Nervous Wreck (II) Inmate

From: East Anglia, England.
Insane since: Sep 2003

posted posted 07-27-2004 11:20

I am planning a page with several checkboxes, each of them will have a link to a page giving details of the selections. The problem I can see is, people could select a few checkboxes and then click on a link, then loose their selections because they hadn't pressed submit/save.

I'm wondering if I could make a link submit the form before it jumps to it's destination?

I don't really want to use new windows for the details pages, if I can avoid it.

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 07-27-2004 11:48
code:
onclick="document.forms.myFormsName.submit()"


should be what you're looking for. Adjust to tastes -if you only got one form, you can skip giving it a name and reference it via
document.forms[0].submit() - please note that this will redirect your browser to the form's target... so you might wish to pass in the new target via a parameter (hidden field, set via javascript) and then redirect there/deliver different content.

So long,

->Tyberius Prime

PaulBM
Nervous Wreck (II) Inmate

From: East Anglia, England.
Insane since: Sep 2003

posted posted 07-27-2004 17:26

That sounds good, I'll give it a try.
Any suggestions on how to pass the destination address to the auto submit though?
I think javascript vars will get cleared on submit. Any variables that are passed in the link will get lost too?

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 07-27-2004 17:33

you need to pass it via a hidden field, which's value you set in your javascript function
(document.forms[0].elements['myField'].value = "whereToGo") - possibly passing in whereToGo from the actual link,
then decide (possibly via php) where to go in the receiving page.

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 07-27-2004 21:58

Umm you may want to realize from the users persepective, if they are selecting a link without saving then they are making a choice not to save what they have checked.

You are breaking the natural web navigation UI. You may want to look at an option that saves the currently selected boxes in a cookie that can restore the selections when they come back from the info page.

Also why not a popup? This is actually a good use of popup windows. You could also use a floating div or something like that as well.



.:[ Never resist a perfect moment ]:.

PaulBM
Nervous Wreck (II) Inmate

From: East Anglia, England.
Insane since: Sep 2003

posted posted 07-28-2004 10:55

Thanks Tyberius, changing the value of the hidden field will work fine. I can come up with some way of keeping track of where the user is popping off to.

bitdamaged, You make a good point. I have wondered about popup windows, it does sound like a good solution too.
I intend to store the values in sessions variables. The selections will be passed to an email routine and sent as an enquiry if the user decides to send the enquiry.

Thanks for the help.

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 07-28-2004 12:48

I've seen webapps that handled forms this way... they were document centric, and you just don't loose the data you just entered because for example you have to look up something in another article. The data doesn't get saved before the user hit's save, but it isn't lost either.

« BackwardsOnwards »

Show Forum Drop Down Menu