This is a discussion on "Hidden forms and submission by link" within the JavaScript Forum section. This forum, and the thread "Hidden forms and submission by link are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Hidden forms and submission by link
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Hidden forms and submission by link
I've got a page that is a list of items in my database. When a user clicks on an item, I need it to go to another page. However, I need to pass several peices of information (and I want to post, not get)
So, I imagine that I could have a hidden form with the framework for the values, but how do I make this happen? I don't know enough javascript to know how this would work. click link, change values in form, submit form I'm sure this is very easy, but I couldn't find it when I searched for it. Thanks jakyra |
|
|
|
|||
|
In the link you want to either use:
HREF="javascript:somefunction(5)" or HREF="#" onclick="somefunction(5)" where the 5 would be the data specific to that link. The second format doesn't show the function name in the status bar of the window. Then in you function you'd set the hidden form values using formname.fieldname.value = "whatever"; finally, when you're ready to submit the form you'd call formname.submit(); you can also change where the form submits to and what window it opens in using: formname.action = "someURL" and formname.target = "_blank" so if you wanted to change which page the data is passed to depending on something in the current page you can do that by changing the action in your function. |
|
|||
|
Sweet!
Thank you! jakyra |
|
||||
|
I would completly avoid this and anything else that is so completly javascript dependant.
Just my $0.02
__________________
Rob - SEO Specialist Owner & Founder of Webforumz.com I am currently unavailable for private work
Last Blog Entry: Creative Labs threaten developer over home made drivers.... (Apr 1st, 2008)
|
|
|||
|
So what woudl you do instead?
jakyra |
|
||||
|
Dunno... as I dont know what you are doing, it would be hard for me to say.
Can you give me an example of what it is you are doing, and what the aim is?
__________________
Rob - SEO Specialist Owner & Founder of Webforumz.com I am currently unavailable for private work
Last Blog Entry: Creative Labs threaten developer over home made drivers.... (Apr 1st, 2008)
|
|
|||
|
I work with books and reviews of said books. We have people who edit the reviews of the books. (Hey, I work at an educational institution.)
I need a way for my editors to see what books need to be edited, and a way for them to get to the page to review the books. I'd rather not use buttons. They're clunky for an entire page of stuff. I want them to click on the ISBN. However, I've set up the review page to serve multiple functions, so I need to send not just the ISBN (which I would be fine with having in the get string) but some state as well. I don't want these to go through the get string because I don't want them to be bookmarkable. (or accessable from "history" So what I want, is a way to click on a link and get information to another page via the post method. jakyra |
|
||||
|
Why cant you store 'state' in session variables or cookies?
That is after all what they are for!
__________________
Rob - SEO Specialist Owner & Founder of Webforumz.com I am currently unavailable for private work
Last Blog Entry: Creative Labs threaten developer over home made drivers.... (Apr 1st, 2008)
|
|
|||
|
uhhh
uhhh Because I'm a braindead flunky and it's Friday? doh! *blush* thanks jakyra |
|
|||
|
ok. I started working on this and this is my problem.
The problem with this is that I can't always set the state variable on a page level. On some pages it would depend on which link you clicked. For example, if you click on one you would edit the book, and another you would say you don't want to review this book anymore. So I can't set the state variable until after the link has been clicked. any other ideas? jakyra |
|
|||
|
I posted some javascript stuff above on modifying form posts with functions called from links that might help.
|
|
|||
|
ahh yes.
I meant to ask in the same post. Is it possible to change the value of a field passed in as a variable? I don't know how to say this... The field that I want to change the value on changes depending on what I'm doing, but I don't want to write a different script for each one... thanks jakyra |
![]() |
| Tags |
| hidden, forms, submission, link |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Assigning a value to Hidden Type. | thanawala84 | Web Page Design | 1 | Oct 13th, 2007 08:10 |
| hidden text | Lchad | Webforumz Cafe | 30 | Jan 5th, 2007 09:12 |
| send mail php with external hidden link?? | lsatdown | PHP Forum | 0 | Nov 28th, 2006 10:48 |
| Hidden Fields | tomd1985 | Web Page Design | 2 | Feb 7th, 2006 20:07 |
| Free Submission - Require No reciprocal Link | Shaw | Link Building and Link Sales | 0 | Nov 17th, 2005 08:11 |