• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Forms and values

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is probably very basic as I haven't done much JavaScript in a while. I have a servlet which displays results from a database query in a FORM so that by clicking a field submits a 2nd servlet.
like
<FORM ACTION=/servlet2...
then several rows of
<tr><td><input type=submit value=? onClick=SubmitForm()>
<INPUT type='hidden' name='vx' value='" + value1 + "'>")
this is repeated for each row
===
everything works, the 2nd servlet is submitted and receives a value but "value1" is always the value of 1st row?. If I click on the nth row I expected it to pass the value for that row not always the 1st. What am I doing wrong ?
Thanks
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Submitting the form from a different location will not change the values of the data that are submitted. There are probably ways around this, but let me understnd what you are trying to do. You want to submit only part of the data on a form based on what row was used to submit it? Is that right? If so, probably the easies way to do this would be to have multiple forms on the page and allow the user to select which one they want to submit.
[This message has been edited by Bodie Minster (edited January 31, 2001).]
 
Tom Caldwell
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes,
This displays rows something like
? 111
? 222
? 333
where if you click on the last row it passes 111 where I was hoping to pass 333
 
Tom Caldwell
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bodie,
I was looking at some examples, can you tell me why this doesn't this work? I modified the form to pass a value like >
<FORM name='queryForm' ACTION= ...
<tr><td><input type=submit value=? onClick=SubmitForm(03807836)
<tr><td><input type=submit value=? onClick=SubmitForm(01234567)
function SubmitForm(passedString)
{
document.queryForm.valuex.value=passedString
document.queryForm.submit()
}
So if you click on the 2nd one shouldn't valuex = 01234567 ??
Thanks
[This message has been edited by Tom Caldwell (edited January 31, 2001).]
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, that should work. Have you tried popping up an alert box inside your function to output the value before submitting the form?
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey, this worked for us, where we were trying to put save, submit, and cancel buttons on the page all in one form that contains the data entered by the client.
Thanks!
 
reply
    Bookmark Topic Watch Topic
  • New Topic