[Javascript] checkbox to change input field value
Russell Scheinberg
rscheinberg at lrk.com
Mon May 22 08:42:52 CDT 2006
[Message delivered by NotifyLink]
----------Original Message----------
From: "Alan Easton" <alaneaston666 at hotmail.com>
Sent: Mon, May 22, 2006 8:17 AM
To: javascript at LaTech.edu
Subject: Re: [Javascript] checkbox to change input field value
Thanks both of you, but I think I am still going to have problems.
If the checkboxes are called "allvals", then response,write request("allvals") will = 7899, 7900, 7901, 7902, 7903 and another with the CHECKED values called "checkvals", then response.write request("checkvals") = 7899, 7900, 7903
So I know 7902 and 7903 are the values that were not checked, just by looking at the 2 variables.
Sorry, I know I have moved away from JS to solve this problem, but if anyone can advise on how to compare the 2 sets of values, and come back with the 2 that are not checked, then I would appreciate it.
Many Thanks.
From: "Mike Dougherty" mdougherty at pbp.com
Reply-To: "\[JavaScript List\]" javascript at LaTech.edu
To: "\[JavaScript List\]" javascript at LaTech.edu
Subject: Re: [Javascript] checkbox to change input field value
Date: Mon, 22 May 2006 09:03:27 -0400
I don't know how well this suggestion works with multiple checkboxes
having the same name (perhaps the already suggested solutions are
'better')
I made a point of doing this:
input type='checkbox' name='Data1' value='D1' /
input type='hidden' name='Data1' value='X' /
If the checkbox IS checked, the value of "Data1" is 'D1,X'
If the checkbox is NOT checked, the value of "Data1" is only 'X'
If you do this, you will always be checking (asp example)
if (Request.Form("Data1").split(',')[0] == "X") {
did_not_check_Data1_checkbox }
It is definately a hack. You get the idea. ymmv
On Mon, 22 May 2006 13:05:58 +0100
"Alan Easton" alaneaston666 at hotmail.com wrote:
Hi All, I have a list of 5 checkboxes on a form and each one has
the same name "ids", but different values. What I would like to
do when I submit the form, is find out which checkbox was NOT
checked. I realise this is not straight forward, as if a checkbox
is not checked, it is not submitted to the server, but can anyone
think of a way round this. I am using ASP, and wanted to simply
have the list of ones that were NOT checked returned in a comma
seperated list or something like that. Does anyone have any
ideas. Any help would be appreciated. Thanks,
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript
More information about the Javascript
mailing list