Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
| Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old September 7th, 2003, 11:10 AM
Registered User
 
Join Date: Aug 2003
Location: Monument, Colorado, USA.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to wjenkins
Default Form data won't transfer to next screen

Hi;
I've got a form which has a LOT of data associated with it and some of the entries have javascript attached to drop down boxes (for selecting quantities). When the javascript executes, it puts data back into the form and all is well. Until I click to go to the next screen. No data gets transferred!
Before I added the javascript, the data would transfer just fine.
I believe there are several problems and I need some help finding a solution.
I have the following: (simplified)

<form name=menuform method=post action=NextPage>
... other data that needs to be xferred based on user selections ....
<form name=form>
<select name=sellist onChange=openxwin($i,form.sellist.options[selectedIndex].value);>
</form>
<input type="submit" name="Submit">
</form>

I have worked on this for quite a while and have discovered the following:
1) Trying to get the form.sellist.options[selectedIndex].value to work without the <form> </form> tags doesn't work at all
2) Trying to get it to work with an array of sellist doesn't work at all
3) If I could get sellist[i].options[selectedIndex].value in the openxwin JavaScript call, I might be able to get it to work and not have to deal with passing the value in the call (which necessitates the <form></form> tags, rendering the form useless).

Help please!
  #2 (permalink)  
Old September 7th, 2003, 11:34 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

The first thing I noticed is that your form tags are nested. Your browser will be confused when you have something like this:
Code:
<form name="frm1">
  <form name="frm2">
    .... Some stuff here
  </form>
</form>
You'll need to change it to this, if it is really necessary to have two forms:
Code:
<form name="frm1">
  .... Some stuff here
</form>
<form name="frm2">
  .... Some stuff here
</form>
I also recommend using quotes for attribute values as they prevent subtle bugs in your code. So change:
Code:
<form name=menuform method=post action=NextPage>
to
Code:
<form name="menuform" method="post" action="NextPage">
This isn't very important for the form tags, but it *is* for form values that contain spaces, for instance.

Is NextPage a valid file name? Or is this a side effect of posting a simplified version of your page??


Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #3 (permalink)  
Old September 8th, 2003, 10:33 PM
Registered User
 
Join Date: Aug 2003
Location: Monument, Colorado, USA.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to wjenkins
Default

Imar;
Thanks for the tips, but what I was really hoping for was someone to say that there is a bug in IE that doesn't allow arrays of select lists. Since all data fields on the form are members of different arrays, and all the arrays are tied together by the first element number (e.g. stuff[1] is associated with morestuff[1], etc.), the select list is just another member of an array. Sadly, it seems that this isn't possible, so what I did was just pass the index number that I'm interested in and in the javascript, I search the appropriate drop-down list for the one that is selected, then take that value and work with it. I was having a problem getting the correct selection, but your previous entry let me get the correct value.
Thanks again!


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to transfer value from one form to another cancertropica C# 2005 1 July 27th, 2008 02:42 PM
How to transfer data from one php form to another aneesh_sunu@yahoo.co.in PHP How-To 2 November 27th, 2006 08:47 AM
Transfer control value from a Form to Subform jimmy0305 Access VBA 1 March 16th, 2006 03:13 PM
Code transfer to form!field Quixote Access VBA 1 July 11th, 2005 09:51 AM
Transfer of Form Values in Javascript pkdev Javascript How-To 3 June 21st, 2004 05:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.