CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 appending a field when checkboxes are checked

Print topic Send  topic

Author Message
Chris T.
Posted: 01/30/2006, 11:57 AM

Basically, whichever checkbox is checked, I want data pertaining to that checkbox to be put into a textbox.

So if I have apple checkbox checked, then I went to save "apple" in the textbox.

If I have apple and banana checked, then I want "apple" and "banana" put into this textbox.


Below is my original post from a different (wrong) forum:
If I have five checkboxes, and they each have a corresponding fruit. If a checkbox is checked, then that fruit name is put into a textbox which is linked to a field in the database.

So if the checkbox for apple is checked, then "apple" is put into this textbox/field

If apple, and orange are checked, then "apple" and "orange" are put into this textbox/field


I have it set up now that when the form is submitted (onclick):
if form.applecheckbox.checkedvalue=true then
form.textbox.value = "apple"
end if
if form.orangecheckbox.checkedvalue=true then
form.textbox.value = form.textbox.value & " " & "orange"
end if
etc...

the textbox is linked to a field in the database, and when I look at this field in the database, no matter what boxes I checked (or if I didn't check any boxes), it fills up the field with every fruit name
Walter Kempees
Posted: 01/30/2006, 12:54 PM

Chris,
Now I am not ASP minded but you check condition is wrong and always true.
I'll try an explain:
In a checkbox named CHECKBOX the following applies:

CHECKBOX.checkedvalue holds the true type defined by you in ProjectSetting
so
CHECKBOX.checkedvalue = true if you defined it to be true
CHECKBOX.checkedvalue = YES if you defined it to be YES
CHECKBOX.checkedvalue = 1 if you defined it to be 1
same applies for the CHECKBOX.uncheckedvalue

so your condition:
if form.orangecheckbox.checkedvalue=true
is always true if in Project Settings you defined it to be true.

Your test should be (and you check the syntax to be ASP correct)
if form.orangecheckbox.value = form.orangecheckbox.checkedvalue
OR
if form.orangecheckbox.value = true

Hope this does it for you.
deducted from your message as you state textbox is ALWAYS filled

Walter K





<ChrisT.@forum.codecharge (Chris T.)> schreef in bericht
news:643de6faa4a294@news.codecharge.com...
> Basically, whichever checkbox is checked, I want data pertaining to that
> checkbox to be put into a textbox.
>
> So if I have apple checkbox checked, then I went to save "apple" in the
> textbox.
>
> If I have apple and banana checked, then I want "apple" and "banana" put
> into
> this textbox.
>
>
> Below is my original post from a different (wrong) forum:
> If I have five checkboxes, and they each have a corresponding fruit. If a
> checkbox is checked, then that fruit name is put into a textbox which is
> linked
> to a field in the database.
>
> So if the checkbox for apple is checked, then "apple" is put into this
> textbox/field
>
> If apple, and orange are checked, then "apple" and "orange" are put into
> this
> textbox/field
>
>
> I have it set up now that when the form is submitted (onclick):
> if form.applecheckbox.checkedvalue=true then
> form.textbox.value = "apple"
> end if
> if form.orangecheckbox.checkedvalue=true then
> form.textbox.value = form.textbox.value & " " & "orange"
> end if
> etc...
>
> the textbox is linked to a field in the database, and when I look at this
> field
> in the database, no matter what boxes I checked (or if I didn't check any
> boxes), it fills up the field with every fruit name
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

Chris T.
Posted: 01/31/2006, 8:40 AM

Ah, I see what you are saying. A little lapse in logic on my part. It makes sense now. Thank you, Walter.

-Chris
Chris T.
Posted: 01/31/2006, 8:46 AM

I tried comparing against the .value and it works perfectly. Thanks.:-D
Walter Kempees
Posted: 01/31/2006, 9:21 AM

And I'm happy too, thought you gave up.
;-)

<ChrisT.@forum.codecharge (Chris T.)> schreef in bericht
news:643df944d36c5f@news.codecharge.com...
>I tried comparing against the .value and it works perfectly. Thanks.:-D
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>


Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.