473,327 Members | 2,118 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Placing value in hidden input onsubmit

Hi,

On submitting the form, I'm trying to place the items of a listbox in
a hidden input. It doesn't work. Is my approach correct?

I have a form like this:

<form name="myForm" onsubmit="return listBoxContents(this.Form.sel1)"
action="project_selection.php" method="post">

and a function as below:

function listBoxContents(sel1)
{
var selLength1 = sel1.options.length,i,values1='';

for(i=0; i<selLength1; i++)
values1+=sel1.options[i].value+ ",";

document.myForm.hiddenName.value = values1;

return true;
}

and the hidden value is as follows:

<input type=hidden name="hiddenName" value="initial">

May 3 '07 #1
1 3641
On May 3, 12:05 pm, tks...@gmail.com wrote:
Hi,

On submitting the form, I'm trying to place the items of a listbox in
a hidden input. It doesn't work. Is my approach correct?

I have a form like this:

<form name="myForm" onsubmit="return listBoxContents(this.Form.sel1)"
action="project_selection.php" method="post">

and a function as below:

function listBoxContents(sel1)
{
var selLength1 = sel1.options.length,i,values1='';

for(i=0; i<selLength1; i++)
values1+=sel1.options[i].value+ ",";

document.myForm.hiddenName.value = values1;

return true;

}

and the hidden value is as follows:

<input type=hidden name="hiddenName" value="initial">

I found that this worked instead: <form name="myForm" onsubmit="return
listBoxContents(this.sel1)" action="project_selection.php"
method="post">

May 3 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: NewbieJon | last post by:
I am attempting to send the variable "sComputerName" from my ActiveX script to "GetInfo.asp" using javascript. (Having been advised this is the way to get my ActiveX variable into my ASP script) ...
8
by: Matt Herson | last post by:
I have been trying to find a way to use JavaScript to change the value of a hidden field on submit. I am already invoking a JavaScript to handle the validation on submit. The reason I need to...
16
by: cwizard | last post by:
I'm calling on a function from within this form, and there are values set but every time it gets called I get slammed with a run time error... document.frmKitAmount.txtTotalKitValue is null or not...
6
by: charlie_M | last post by:
I figured out via various help from this forum... EXAMPLE: onClick="document.forms.MYBUTTON.value='SIMPLE';document.forms.submit()" In my CGI I see "MYBUTTON" = "SIMPLE" and this works...
5
by: Larry | last post by:
I have a form that submits some js created data through a formmail script. One field of the form is a text box for the person's name. I'd like the subject line of the resulting email to be "Some...
4
by: Mangler | last post by:
Without writing a bible on what I'm trying to do I'll see if someone can answer a quick question. I have a form that the user writes a value in a test field. I need to put a hidden value that...
4
by: frank78 | last post by:
Hi all, I'm having an issue with passing form values from one page to the next. I wrote a function that I use to change the value of a hidden field to any number of dynamically generated form...
1
Fary4u
by: Fary4u | last post by:
Hi Guys i'm trying to upload a file, i've tried 3 different methods but still not work out i don't know how to over come this problem hidden file value, multiple form or popup uploading. 1-...
4
by: AR123 | last post by:
In the field for employee contribution I want to have GBP and make sure that this prints out in the results email. How can I set it up so that the GBP display next to the value in the results email?...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.