Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread
Author: Subject: Check for checkbox
sunjournal
Newbie

Posts: 1
Registered: 8/19/2004
Location: Lewiston, Maine
Member Is Offline
posted on 8/19/2004 at 02:08 PM Reply With Quote
Check for checkbox


Great script. I'm wondering how to check for radio buttons and checkboxes in a form to make sure a user has selected one?
View User's Profile View All Posts By User U2U Member
opacons
Junior Member

Posts: 2
Registered: 12/23/2004
Member Is Offline
posted on 12/24/2004 at 12:43 AM Reply With Quote

Me too
View User's Profile View All Posts By User U2U Member
tigra
Administrator

Posts: 2049
Registered: 6/17/2002
Location: US, CO
Member Is Offline
posted on 2/17/2005 at 07:48 PM Reply With Quote

fix introduced in v1.2
View User's Profile View All Posts By User U2U Member
zip_puff
Junior Member

Posts: 2
Registered: 5/4/2005
Member Is Offline
posted on 5/4/2005 at 02:12 AM Reply With Quote
check boxes / radio buttons


This is a wonderful script: clean, professional, deploys easy. But I haven't been able to discern the fix for check boxes / radio buttons. Where can I find the documentation please?
View User's Profile View All Posts By User U2U Member
zip_puff
Junior Member

Posts: 2
Registered: 5/4/2005
Member Is Offline
posted on 5/4/2005 at 05:10 AM Reply With Quote
check boxes / radio buttons


This is the code from validator.js.

else if (o_input.length > 0) // radiobuton
for (var n_index = 0; n_index < o_input.length; _index++)
if (o_input[n_index].checked) {
s_value = o_input[n_index].value; break;
}

But I saw nothing collateral in the form fields description structure, so I created:

'radiobutton':{'l':'Advertiser or Visitor','r':true,'f':'radiobutton','t':'t_radiobutton',},


The HTML is:

<tr>
<td align="left" valign="middle" id="t_radiobutton">&nbsp;</td>
<td colspan="2">Advertiser<input type="radio" name="radiobutton" value="radiobutton"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Visitor&nbsp;
<input type="radio" name="radiobutton" value="radiobutton"></td>
</tr>

What am I missing?
View User's Profile View All Posts By User U2U Member
katAttack
Junior Member

Posts: 6
Registered: 6/3/2005
Member Is Offline
posted on 6/3/2005 at 12:51 AM Reply With Quote

I have checkboxes working, both as <b>isolated</b> one off elements and as <b>collective groups</b>.

my collective example:

<form....>

<p><input type="checkbox" name="fObtainedKnowledge" value="Supervision" id="fHowSupervision">&nbsp;&nbsp;<label for="fHowSupervision">Supervision</label></p>
<p><input type="checkbox" name="fObtainedKnowledge" value="Other%20Training" id="fHowTraining">&nbsp;&nbsp;<label for="fHowTraining">Other&nbsp;training</label></p>
<p><input type="checkbox" name="fObtainedKnowledge" value="Reading" id="fHowRead">&nbsp;&nbsp;<label for="fHowRead">Reading</label></p>
<p><input type="checkbox" name="fObtainedKnowledge" value="Practical%20Experience" id="fHowPractical">nbsp;&nbsp;<label for="fHowPractical">Practical&nbsp;experience</label></p>
....</form>

In the example above I want them to make at LEAST one checkbox choice. The group is collectively named <b>"fObtainedKnowledge"</b> so I get a single array of values posted by the form.

In line with HTML 4 and accessibility each element in the collective group have a unique ID e.g fHowPractical, fHowRead, fHowTraining .....

The <b>Tiagra definition entry for this field group</b> is:

.....
'fObtainedKnowledge':{'l':'Where you obtained the knowledge','r':true,'t':'labelIDtoHighlight'},
.....

This forces at least one checkbox to be ticked and if none are ticked the HTML element named ID="labelIDtoHighlight" will be flagged to the user...

There is an obvious issue here if you desire to highlight/flag all elements within the collective group as the code only supports the identification of a single element ID for the 'flag' function.

I have a solution though, I wrote new code to support the passing of an array of ID names for the 'l': "labelID" function.
View User's Profile View All Posts By User U2U Member
gtennant
Junior Member

Posts: 2
Registered: 1/16/2006
Location: Hampton, ON, Canada
Member Is Offline
posted on 1/16/2006 at 02:50 PM Reply With Quote
Care to share katattack?


I'm not a programmer, but I can find my way around HTML and Flash quite well. I need to check a form to ensure that a set of 5 checkboxes have been selected, before the form gets submitted, and the viewer is taken to a "congratulations" page. Care to share your "code" on how that might be done?

Appreciated immensely, in advance.


Here's my form code:

<form action="" method="post" enctype="application/x-www-form-urlencoded" name="Survey" class="style9" id="Survey">
<p>Take our (required) short survey... </p>
<p class="text">
<input name="income" type="checkbox" id="income" value="income yes">
<span class="style10">Can you prove (verify) your income?</span></p>
<p class="text">
<input name="residence" type="checkbox" id="residence" value="residence yes">
<span class="style10">Can you prove (verify) your residence?</span></p>
<p class="text">
<input name="drivers_licence" type="checkbox" id="drivers_licence" value="driver's licence">
Do you have a valid driver's license?</p>
<p class="text">
<input name="insurable" type="checkbox" id="insurable" value="insurable yes">
Are you insurable?</p>
<p class="text">
<input name="downpayment" type="checkbox" id="downpayment" value="downpayment yes">
Do you have a minimum of $299 (+tax=$344) for a down payment?</p>
<p class="text">
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Submit2" value="Reset">
</p>
</form>
View User's Profile View All Posts By User U2U Member
davidwwatts
Junior Member

Posts: 9
Registered: 12/15/2003
Member Is Offline
posted on 1/14/2007 at 03:51 PM Reply With Quote

I've managed to implement katattack's code, however the resulting parameters passed to the CGI script on the form don't appear to work. The problem is that if two checkboxes are checked, then two variables of the same name are passed.

Using katattach's example, if Supervision and Reading were checked, then the parameters passed will be

mailer.cgi?fObtainedKnowledge=Supervision&fObtainedKnowledge=Reading

So how is the CGI supposed to be able to process that properly? All I get when I look at that variable is the value "Reading".

Anyone successfuly implemented checkbox validation? Unfortunately, it's not in the documentation?
David.
View User's Profile View All Posts By User U2U Member
davidwwatts
Junior Member

Posts: 9
Registered: 12/15/2003
Member Is Offline
posted on 1/16/2007 at 01:30 PM Reply With Quote

Ok answering my own question. The answer is it depends on the language used. I'm using Perl, so the syntax is:

my @fObtainedKnowledge = $query->param("fObtainedKnowledge");

Then I can address each of them as $fObtainedKnowledge[0] for the first one or $fObtainedKnowledge[1] for the 2nd one and so on.

David.
View User's Profile View All Posts By User U2U Member
Hollstar
Member

Posts: 11
Registered: 4/4/2008
Location: Australia
Member Is Offline
posted on 4/11/2008 at 12:32 PM Reply With Quote

Depending on how you're using the checkboxes in question, it should be like checking any other form element.

In my example, I have an array of checkboxes thus the code is as follows:
'chkCheckboxArray[]':{'l':'Error Title','r':true,'t':'t_txtCheckboxID'}
View User's Profile View All Posts By User U2U Member
gtennant
Junior Member

Posts: 2
Registered: 1/16/2006
Location: Hampton, ON, Canada
Member Is Offline
posted on 4/11/2008 at 12:43 PM Reply With Quote

Look at the date of the last message.

This thread is dead, it's 5 years old...


Gil
View User's Profile View All Posts By User U2U Member
ScriptKid
Junior Member

Posts: 2
Registered: 5/5/2008
Member Is Offline
posted on 5/5/2008 at 03:01 PM Reply With Quote
Please post an example then


As far as I know checkboxes are not supported in the latest version of Tigra Form Validator.

There is nothing in the documentation about setting it up.

Anyone have an example? I'll create a new thread if I need to...
View User's Profile View All Posts By User U2U Member
ScriptKid
Junior Member

Posts: 2
Registered: 5/5/2008
Member Is Offline
posted on 5/12/2008 at 08:27 PM Reply With Quote

I got it working with version 1.3.

The registered version that I have of Tigra Validator PRO is 1.1. The checkbox issue was fixed in version 1.2.

Unfortunately this means I must use either the Validator PRO 1.1 or the FREE Validator 1.3.

How do I get an upgraded version of PRO 1.3? I cannot find my registration information (it's been a couple years... perhaps we have to renew?) It's been 72 hours since I submitted this to customer service with no resolution. I heard back from customer service and confirmed that I cannot locate the registration # for 1.1.

At this time I do have checkboxes working, but I need to add custom locale Alert Confirmation messages that is only provided in the PRO editions.
View User's Profile View All Posts By User U2U Member
tigra
Administrator

Posts: 2049
Registered: 6/17/2002
Location: US, CO
Member Is Offline
posted on 5/12/2008 at 09:20 PM Reply With Quote

The product comes with free upgrades during at least one year since the date of your purchase.
Usually we provide non-major version upgrades free of charge even after that free term expires.
To get the new version please submit a support ticket providing your order ID.
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Product Page Product Page
Product Demonstrations Product Demos
Registration Form Validation
Login Form Validation
Free Download Free Download
Product Documentation Documentation
Documenation Page
Change Log
Validators Comparison Table
Support Forum Support Forum
 

Go To Top


Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004