[thelist] AJAX - expose a div with radio buttons, select & submit/save to mysql

Simon MacDonald simonmacdonald at uk2.net
Thu Aug 12 03:27:19 CDT 2010


Bob, 

The value attribute is not valid for an anchor tag so 'this.value' is
undefined. 
You are effectively creating a custom attribute with 'value'.
If you pass 'this' instead of 'this.value' this will pass an element
reference to the script. 

I think this will get 'value' :

function getRating (element){
var eValue = element.getAttribute("value");

if (eValue =='discipline1') {
....do something

}

I'm not sure if your html will parse as valid with the custom attribute,
tho.
PS The anchor name attribute should be used for creating named anchors

HTH
Regards

Simon

-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Bob Meetin
Sent: 12 August 2010 4:32 AM
To: thelist at lists.evolt.org
Subject: Re: [thelist] AJAX - expose a div with radio buttons, select &
submit/save to mysql

Nah, just break it down to individual steps. Say for step 4:
> 1) create a simple HTML form with fields for the info you want to save
> 2) write the backend code for the form submission (parse and write the
>      parameters to the DB)
> 3) test, adjust as necessary
> 4) write your mootools-based method to gather that form data and
>      submit via XHR request
> 5) attach onsubmit event handler to "save" button to invoke that
>      method and hide the div in question
> 6) test
>
> and done! Those are all pretty straightforward, the first 3 being what
> you'd have to do if there were no such thing as AJAX. Except #2
> doesn't need to return a complete page, just status, or a message,
> or whatever you want.
A little progress, but with the link option it will not respond to 
onClick. See: http://dottedi.biz/code/ajax/test/

<li><a href="#" name="discipline" value="1"
onClick="getRating(this.value);">Option 1</a></li>
<li><a href="#" name="discipline" value="2"
onClick="getRating(this.value);">Option 2</a></li>
<li><a href="#" name="discipline" value="3"
onClick="getRating(this.value);">Option 3</a></li>

Where am I off course?

-- 
Bob 

-- 

* * 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 5359 (20100811) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 
 

__________ Information from ESET Smart Security, version of virus signature
database 5359 (20100811) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 



More information about the thelist mailing list