Ask a Question related to ASP, Design and Development.
-
only_me #1
Re: checkboxes
"cbool" might help
if cbool(request.form("mychk")) = true then
"Paul" <paul@themedialounge.com> wrote in message
news:OExAuoRTDHA.2228@tk2msftngp13.phx.gbl...> I know this is gonna sound silly but when I submit a form with a checkbox
> html control "mychk", how can I see if that is checked or not ?
>
> I have tried :
>
> if request.form("mychk") = true then
> ' code
> else
> ' code
> end if
>
> But it always executes the code in the else statement meaning it is never
> true despite the fact I have given the checkbox a value of true.
>
>
>
only_me Guest
-
What to do about checkboxes?
I have a grid with odds and ends of data, some of the fields are true/false checkboxes. The users don't like the fact that the checkboxes are... -
PHP checkboxes
How do I send CHECKBOXES via email through the mail() function in PHP? Example: You have 67 checkboxes, all with unique names, but only want to... -
[PHP] Checkboxes
You could try this: <input type="hidden" name="box1" value="0"> <input type="checkbox" name="box1" value="1"> So basically when it get... -
ASP.NET Checkboxes
Thanx M, and I mean that, but I really need this to work without a postback and frankly it should behave like the other controls are behaving... -
CGI and checkboxes
How do I get the value from a checkbox made with cgi.checkbox ? I need to make a decision based on whether or not the checkbox is checked - will... -
Bob Barrows #2
Re: checkboxes
Paul wrote:
The variable contains a string, not a boolean value. true is a constant that> I know this is gonna sound silly but when I submit a form with a
> checkbox html control "mychk", how can I see if that is checked or
> not ?
>
> I have tried :
>
> if request.form("mychk") = true then
evaluates to either True or False (numerically -1 or 0).
So you need to a) cast the variable to a boolean using cbool() or b) compare
the variable to a string, using "true".
However, this is not the optimal method. If the checkbox is not checked, it
will have no value. So simply check the variable's length:
if len(request.form("mychk")) > 0 then
'it was checked
HTH,
Bob Barrows
Bob Barrows Guest
-
Tom B #3
Re: checkboxes
If the checkbox is checked then it has a value, if it's not then there's
nothing
if Request.Form("mychk")="" then
'not checked
else
'checked
end if
or you can specify
<input type=checkbox name=mychk value='BOB'>
if Request.Form("mychk")="BOB" then
'it was checked
end if
You can also use the same name for multiple checkboxes (like you do for
radio buttons)
<input type=checkbox name=mychk value='BOB'>BOB
<input type=checkbox name=mychk value='FRED'>FRED
Response.write Request.Form("mychk") would display BOB, FRED (assuming both
checked)
"Paul" <paul@themedialounge.com> wrote in message
news:OExAuoRTDHA.2228@tk2msftngp13.phx.gbl...> I know this is gonna sound silly but when I submit a form with a checkbox
> html control "mychk", how can I see if that is checked or not ?
>
> I have tried :
>
> if request.form("mychk") = true then
> ' code
> else
> ' code
> end if
>
> But it always executes the code in the else statement meaning it is never
> true despite the fact I have given the checkbox a value of true.
>
>
>
Tom B Guest
-
Cesar Aracena #4
Checkboxes
Hi all,
I am wondering what would be the best way to handle checkboxes. I am
making a site that will display several items in a 20-items-per-page
format and each item will have a checkbox next to it for the user to
select them. Now, what I need to do is to record the items selected by
the user when clicking the “Next button” into a MySQL table. Should I
name all the checkboxes the same, using the item IDs as values and then
use an array to see which ones where selected or maybe another thing?
Thanks in advanced,
Cesar Aracena
<http://www.icaam.com.ar> [url]www.icaam.com.ar[/url]
Note: The information inside this message and also in the attached files
might be confidential. If you are not the desired receptor or the person
responsible of delivering the message, we notify you that it's copy,
distribution, keep or illegal use of the information it has it's
prohibited. Therefore we ask you to notify the sender by replying this
message immediately and then delete it from your computer.
Cesar Aracena Guest
-
'bonehead #5
Checkboxes
Okay, I've only been doing php/mysql for a few months and I admit to
being a little stumped on this one.
I have a form which posts updates to a mysql table. I'd like to use
checkboxes to show and update boolean type values. In Access it's very
simple to create a field of type Yes/No, bind a form to the table, and
bind a checkbox object to the Yes/No field. I am unable to find generic
examples of this in php/mysql.
1. What field type should I use in a mysql table?
2. When the php<html><form> loads the data from the selected record,
what is the generic syntax for initializing the check box?
'bonehead Guest
-
Michael Fuhr #6
Re: Checkboxes
'bonehead <senmenospam@here.org> writes:
MySQL has a BOOL type but it's just a synonym for TINYINT(1).> I have a form which posts updates to a mysql table. I'd like to use
> checkboxes to show and update boolean type values. In Access it's very
> simple to create a field of type Yes/No, bind a form to the table, and
> bind a checkbox object to the Yes/No field. I am unable to find generic
> examples of this in php/mysql.
>
> 1. What field type should I use in a mysql table?
Another possibility would be ENUM.
Here's one way:> 2. When the php<html><form> loads the data from the selected record,
> what is the generic syntax for initializing the check box?
// Set the variable $foo from the database or from form data.
$checked = $foo ? "checked" : "";
echo "<input type=\"checkbox\" name=\"foo\" $checked>";
Or later if you're outside PHP:
<input type="checkbox" name="foo" <?php echo $checked?>>
Or you could omit the $checked variable:
<input type="checkbox" name="foo" <?php echo $foo ? "checked" : ""?>>
There are several ways to do this; the important thing is to print
the "checked" attribute if the boolean variable is on/true.
--
Michael Fuhr
[url]http://www.fuhr.org/~mfuhr/[/url]
Michael Fuhr Guest
-
Christopher Finke #7
Re: Checkboxes
"Michael Fuhr" <mfuhr@fuhr.org> wrote in message
news:3fc43cf0$1_3@omega.dimensional.com...Although, in the newer implementations of HTML, that would be> 'bonehead <senmenospam@here.org> writes:
>
> $checked = $foo ? "checked" : "";
$checked = $foo ? 'checked="true"' : '';
Christopher Finke
Christopher Finke Guest
-
Michael Fuhr #8
Re: Checkboxes
"Christopher Finke" <christopherfinke@hotmail.usenet.com> writes:
Shouldn't that be 'checked="checked"'? That's what the XHTML 1.0> "Michael Fuhr" <mfuhr@fuhr.org> wrote in message
> news:3fc43cf0$1_3@omega.dimensional.com...>> > 'bonehead <senmenospam@here.org> writes:
> >
> > $checked = $foo ? "checked" : "";
> Although, in the newer implementations of HTML, that would be
>
> $checked = $foo ? 'checked="true"' : '';
DTD appears to require, and using "true" causes XHTML 1.0 and 1.1
documents to fail validation at validator.w3.org.
--
Michael Fuhr
[url]http://www.fuhr.org/~mfuhr/[/url]
Michael Fuhr Guest
-
bonehead #9
Re: Checkboxes
Michael Fuhr wrote:
Got it working...thanks. The exact syntax for the checked argument is> Here's one way:
>
> // Set the variable $foo from the database or from form data.
> $checked = $foo ? "checked" : "";
> echo "<input type=\"checkbox\" name=\"foo\" $checked>";
>
> Or later if you're outside PHP:
>
> <input type="checkbox" name="foo" <?php echo $checked?>>
where I was getting stumped.
Meanwhile, I came up with another fairly trivial question. I'll post it
under the heading "Textarea Formatting".
bonehead Guest
-
jasperm #10
checkboxes
:confused;
I have developed a roster sign-up list on my website. I want visitors to be
able to go in, check off their names, and have that infomation remain on the
site for everyone to see. As each players updates the site, I want the
checkboxes to remain clicked. Right now, the checkboxes turn blank on refresh.
Is there a way I can add a checkbox that will "stay checked" once it's been
clicked? Maybe using Javascript?
Thanks
jasperm Guest



Reply With Quote

