Ask a Question related to ASP, Design and Development.
-
Dan #1
Checkbox Set To OFF Not In Request.Form
When using checkboxes on a form, if you uncheck them, the unchecked
name/value pair in the Request.Form collection doesn't show up. It only
shows when the checkbox is set to ON.
Is this correct? What's the workaround if it is?
Dan Guest
-
How do I use the form checkbox value?
I'm creating a form that has multiple checkboxes. I want to use ActionScript to update a text box/area with the values each checkbox as the checkbox... -
Flash Form & Checkbox
I'm having trouble changing this listbox code to checkboxes instead. Can you help? <cfselect name="binderyID" label = "Bindery Type"... -
Confused about a REQUEST.FORM and a REQUEST.QUERYSTRING
This is snipit of code, supplied by PayPal with explanation about what has to be done to access their back end. I am confused because they first... -
Yes/No checkbox in the form
I have a field called action in a table, to check if something requires action the user must check the box. The field in the table is defined as a... -
best way to get data: request.form, request.params, controlname.value
Hi! I think I remember somewhere that using request.form was a bad idea (I can't say I remember why). So I'm wondering: What is the best way to... -
Ray at #2
Re: Checkbox Set To OFF Not In Request.Form
"Dan" <trdwnds@gte.net> wrote in message
news:OsZHynokDHA.3256@tk2msftngp13.phx.gbl...Yes it is.> When using checkboxes on a form, if you uncheck them, the unchecked
> name/value pair in the Request.Form collection doesn't show up. It only
> shows when the checkbox is set to ON.
>
> Is this correct?
That depends on what you're trying to do. What are you trying to do?> What's the workaround if it is?
Ray at work
Ray at Guest
-
Aaron Bertrand - MVP #3
Re: Checkbox Set To OFF Not In Request.Form
> Is this correct?
Yep.
Well, that depends. If you are trying to store state in a database, rather> What's the workaround if it is?
than trying to figure out what checkboxes WEREN'T checked, is I clear the
data and then start fresh with only the options that were checked. This
logic is much easier, and works well with checkboxes that are generated
dynamically...
Other things you can do:
<input type=hidden name=possible value='a, b, c'>
<input type=checkbox name=actual value='a'> A
<input type=checkbox name=actual value='b'> B
<input type=checkbox name=actual value='c'> C
Then on the receiving page, you can compare the strings. If they differ,
you can use split to determine which elements are still in possible that
aren't in actual (previously checked but no longer checked).
A
Aaron Bertrand - MVP Guest
-
Aaron Bertrand - MVP #4
Re: Checkbox Set To OFF Not In Request.Form
> Then on the receiving page, you can compare the strings. If they differ,
Oh and you can also determine which ones were previously unchecked and now> you can use split to determine which elements are still in possible that
> aren't in actual (previously checked but no longer checked).
are checked, e.g.
<input type=hidden name=possible value='a, b, c'>
<input type=hidden name=previous value='a, b'>
<input type=checkbox name=actual value='a' CHECKED> A
<input type=checkbox name=actual value='b' CHECKED> B
<input type=checkbox name=actual value='c'> C
Now, you can compare actual to possible (to determine those that are
unchecked) and you can also compare actual to previous (to determine both
those that were previously checked and have been turned off, and those that
were previously unchecked and have been turned on).
Aaron Bertrand - MVP Guest
-
Dan #5
Re: Checkbox Set To OFF Not In Request.Form
I'm trying to implement a SQL Server 2000 'edit record' page that has BIT
fields (boolean value).
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:eJMSBqokDHA.644@TK2MSFTNGP11.phx.gbl...>
> "Dan" <trdwnds@gte.net> wrote in message
> news:OsZHynokDHA.3256@tk2msftngp13.phx.gbl...>> > When using checkboxes on a form, if you uncheck them, the unchecked
> > name/value pair in the Request.Form collection doesn't show up. It only
> > shows when the checkbox is set to ON.
> >
> > Is this correct?
> Yes it is.
>> That depends on what you're trying to do. What are you trying to do?> > What's the workaround if it is?
>
> Ray at work
>
>
Dan Guest
-
Ray at #6
Re: Checkbox Set To OFF Not In Request.Form
Uh, fine. :] But, what are you trying to do that requires that you know if
a checkbox has been unchecked? What Aaron suggested will typically work for
most things. The synapse between your explanation below and the checkbox
query is a bit too large.
Ray at work
"Dan" <trdwnds@gte.net> wrote in message
news:OuXiR8okDHA.1096@TK2MSFTNGP11.phx.gbl...only> I'm trying to implement a SQL Server 2000 'edit record' page that has BIT
> fields (boolean value).
>
>
> "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
> news:eJMSBqokDHA.644@TK2MSFTNGP11.phx.gbl...> >
> > "Dan" <trdwnds@gte.net> wrote in message
> > news:OsZHynokDHA.3256@tk2msftngp13.phx.gbl...> > > When using checkboxes on a form, if you uncheck them, the unchecked
> > > name/value pair in the Request.Form collection doesn't show up. It>> >> > > shows when the checkbox is set to ON.
> > >
> > > Is this correct?
> > Yes it is.
> >> > That depends on what you're trying to do. What are you trying to do?> > > What's the workaround if it is?
> >
> > Ray at work
> >
> >
>
Ray at Guest
-
Phillip Windell #7
Re: Checkbox Set To OFF Not In Request.Form
Why not just this:
MyVar = Request.Form("MyCheckBox")
If MyVar <> "ON" Then MyVar = "OFF"
'Now the MyVar will either be "ON" or it will be "OFF"
--
Phillip Windell [CCNA, MVP, MCP]
[email]pwindell@wandtv.com[/email]
WAND-TV (ABC Affiliate)
[url]www.wandtv.com[/url]
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in
message news:OHIAp#okDHA.1096@TK2MSFTNGP11.phx.gbl...know if> Uh, fine. :] But, what are you trying to do that requires that youwork for> a checkbox has been unchecked? What Aaron suggested will typicallycheckbox> most things. The synapse between your explanation below and thehas BIT> query is a bit too large.
>
> Ray at work
>
> "Dan" <trdwnds@gte.net> wrote in message
> news:OuXiR8okDHA.1096@TK2MSFTNGP11.phx.gbl...> > I'm trying to implement a SQL Server 2000 'edit record' page thatmessage> > fields (boolean value).
> >
> >
> > "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote inunchecked> > news:eJMSBqokDHA.644@TK2MSFTNGP11.phx.gbl...> > >
> > > "Dan" <trdwnds@gte.net> wrote in message
> > > news:OsZHynokDHA.3256@tk2msftngp13.phx.gbl...
> > > > When using checkboxes on a form, if you uncheck them, theup. It> > > > name/value pair in the Request.Form collection doesn't showto do?> only> > > > shows when the checkbox is set to ON.
> > > >
> > > > Is this correct?
> > >
> > > Yes it is.
> > >
> > > > What's the workaround if it is?
> > > That depends on what you're trying to do. What are you trying>> >> > >
> > > Ray at work
> > >
> > >
> >
>
Phillip Windell Guest
-
Dan #8
Re: Checkbox Set To OFF Not In Request.Form
I have a canned routine that reads the Request.Form collection and prepares
the INSERT or UPDATE statement. If a checkbox is initially checked, and is
then unchecked, that field name won't make it into the Request.Form
collection for the auto-generation of the SQL UPDATE statement without a
changing my canned routine that's heretofore been working fine (without the
use of checkboxes on the form). So, I'll modify my routine to detect this
special handling.
"Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote in message
news:ecHyWvokDHA.2200@TK2MSFTNGP12.phx.gbl...rather>> > Is this correct?
> Yep.
>>> > What's the workaround if it is?
> Well, that depends. If you are trying to store state in a database,> than trying to figure out what checkboxes WEREN'T checked, is I clear the
> data and then start fresh with only the options that were checked. This
> logic is much easier, and works well with checkboxes that are generated
> dynamically...
>
> Other things you can do:
>
> <input type=hidden name=possible value='a, b, c'>
> <input type=checkbox name=actual value='a'> A
> <input type=checkbox name=actual value='b'> B
> <input type=checkbox name=actual value='c'> C
>
> Then on the receiving page, you can compare the strings. If they differ,
> you can use split to determine which elements are still in possible that
> aren't in actual (previously checked but no longer checked).
>
> A
>
>
>
Dan Guest
-
Dan Sikorsky #9
Re: Checkbox Set To OFF Not In Request.Form
Your solution will handle a particular case, but I need to detect state info
(see my response to Aaron Bertrand).
--
Thank you,
Dan Sikorsky MSCS, BSCE, BAB
"Phillip Windell" <pwindell{at}wandtv*d0t*com> wrote in message
news:OA7tBLpkDHA.3700@TK2MSFTNGP11.phx.gbl...> Why not just this:
>
> MyVar = Request.Form("MyCheckBox")
> If MyVar <> "ON" Then MyVar = "OFF"
>
> 'Now the MyVar will either be "ON" or it will be "OFF"
>
>
> --
>
> Phillip Windell [CCNA, MVP, MCP]
> [email]pwindell@wandtv.com[/email]
> WAND-TV (ABC Affiliate)
> [url]www.wandtv.com[/url]
>
> "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in
> message news:OHIAp#okDHA.1096@TK2MSFTNGP11.phx.gbl...> know if> > Uh, fine. :] But, what are you trying to do that requires that you> work for> > a checkbox has been unchecked? What Aaron suggested will typically> checkbox> > most things. The synapse between your explanation below and the> has BIT> > query is a bit too large.
> >
> > Ray at work
> >
> > "Dan" <trdwnds@gte.net> wrote in message
> > news:OuXiR8okDHA.1096@TK2MSFTNGP11.phx.gbl...> > > I'm trying to implement a SQL Server 2000 'edit record' page that> message> > > fields (boolean value).
> > >
> > >
> > > "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in> unchecked> > > news:eJMSBqokDHA.644@TK2MSFTNGP11.phx.gbl...
> > > >
> > > > "Dan" <trdwnds@gte.net> wrote in message
> > > > news:OsZHynokDHA.3256@tk2msftngp13.phx.gbl...
> > > > > When using checkboxes on a form, if you uncheck them, the> up. It> > > > > name/value pair in the Request.Form collection doesn't show> to do?> > only> > > > > shows when the checkbox is set to ON.
> > > > >
> > > > > Is this correct?
> > > >
> > > > Yes it is.
> > > >
> > > > > What's the workaround if it is?
> > > > That depends on what you're trying to do. What are you trying>> >> > > >
> > > > Ray at work
> > > >
> > > >
> > >
> > >
> >
>
Dan Sikorsky Guest
-
Dan Sikorsky #10
Re: Checkbox Set To OFF Not In Request.Form
(see my response to Aaron Bertrand)
--
Thank you,
Dan Sikorsky MSCS, BSCE, BAB
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:OHIAp%23okDHA.1096@TK2MSFTNGP11.phx.gbl...if> Uh, fine. :] But, what are you trying to do that requires that you knowfor> a checkbox has been unchecked? What Aaron suggested will typically workBIT> most things. The synapse between your explanation below and the checkbox
> query is a bit too large.
>
> Ray at work
>
> "Dan" <trdwnds@gte.net> wrote in message
> news:OuXiR8okDHA.1096@TK2MSFTNGP11.phx.gbl...> > I'm trying to implement a SQL Server 2000 'edit record' page that has> only> > fields (boolean value).
> >
> >
> > "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
> > news:eJMSBqokDHA.644@TK2MSFTNGP11.phx.gbl...> > >
> > > "Dan" <trdwnds@gte.net> wrote in message
> > > news:OsZHynokDHA.3256@tk2msftngp13.phx.gbl...
> > > > When using checkboxes on a form, if you uncheck them, the unchecked
> > > > name/value pair in the Request.Form collection doesn't show up. It>> >> > > > shows when the checkbox is set to ON.
> > > >
> > > > Is this correct?
> > >
> > > Yes it is.
> > >
> > > > What's the workaround if it is?
> > > That depends on what you're trying to do. What are you trying to do?
> > >
> > > Ray at work
> > >
> > >
> >
>
Dan Sikorsky Guest
-
Phillip Windell #11
Re: Checkbox Set To OFF Not In Request.Form
I looked and I don't see the problem. I don't see "detecting state"
having any bearing on it. Yes you routine that gathers the values
would have to change, but that is kinda a "given".
--
Phillip Windell [CCNA, MVP, MCP]
[email]pwindell@wandtv.com[/email]
WAND-TV (ABC Affiliate)
[url]www.wandtv.com[/url]
"Dan Sikorsky" <dsikor@gte.net> wrote in message
news:e0odVuykDHA.3732@tk2msftngp13.phx.gbl...state info> Your solution will handle a particular case, but I need to detect> (see my response to Aaron Bertrand).
>
> --
> Thank you,
>
> Dan Sikorsky MSCS, BSCE, BAB
Phillip Windell Guest



Reply With Quote

