[thelist] AJAX - expose a div with radio buttons, select & submit/save to mysql
Simon MacDonald
simonmacdonald at uk2.net
Fri Aug 13 03:17:12 CDT 2010
For class-"q7" read class="q7" - told you I was good at typos
S
-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Simon MacDonald
Sent: 13 August 2010 9:11 AM
To: bobm at dottedi.biz; thelist at lists.evolt.org
Subject: Re: [thelist] AJAX - expose a div with radio buttons, select &
submit/save to mysql
Bob
If I understand correctly what you are trying to do you could try this.
I have used the mootools $$ function to return an array of input tags of a
particular class and then walk the array to find the checked one - you would
have to add a different class to each input set and walk each one.
There's probably neater ways of coding it but it worked for me.
(apologies in advance for any typos - I always manage to get some in!)
=============html=========================================
<div class="stretcher">
<p class="compact">
<input class-"q7" name="Q7" value="0" type="radio"><span>0</span>
<input class-"q7" name="Q7" value="1" type="radio"><span>1</span>
<input class-"q7" name="Q7" value="2" type="radio"><span>2</span>
<input class-"q7" name="Q7" value="3" checked="checked"
type="radio"><span>3</span>
<input class-"q7" name="Q7" value="4" type="radio"><span>4</span>
Element 1
</p>
<p class='c'><input type="submit" name="submit" value="Save »"
onClick="getCloseRating()></p>
.
.
=============Javascript=========================================
function getCloseRating(){
// get checked button
var pt = $$("input.q7");// mootools $$ function returns an array of
input tags with class q7
// walk the array to find checked button
if (pt.length != 0)// check to see if a button selected
{
var ptIndex = "";
for (var i=0; i < pt.length; i++)
{
if (pt[i].checked)
{
//do something
}
}
}
HTH
Simon
__________ Information from ESET Smart Security, version of virus signature
database 5362 (20100813) __________
The message was checked by ESET Smart Security.
http://www.eset.com
--
* * Please support the community that supports you. * *
http://evolt.org/help_support_evolt/
For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !
__________ Information from ESET Smart Security, version of virus signature
database 5362 (20100813) __________
The message was checked by ESET Smart Security.
http://www.eset.com
__________ Information from ESET Smart Security, version of virus signature
database 5362 (20100813) __________
The message was checked by ESET Smart Security.
http://www.eset.com
More information about the thelist
mailing list