View Single Post
Old 06-18-2009, 04:26 AM   #1 (permalink)
Kay1021
The Contributor
 
Join Date: May 2008
Posts: 36
Thanks: 5
Kay1021 is on a distinguished road
Default onSelect/onDeselect working at same time?

I'm kinda a newbie to Javascript but i have seemed to figure out one part of what i am trying to do and need help with the second part. What i am trying to do is this checkbox that has a style from here http://lipidity.com/fancy-form/. But what i wanted was that once you click select or deselect the checkbox that it is automatically updated to the database. I was already doing something like this with a textarea and i finally figured out how to get it to work with my checkbox. I used part of the help the site gave..
Code:
FancyForm.start( 0, {
	onSelect: function(chk){
		alert(chk.inputElement.getProperty('name'));
	}
});

and rearranged it and used some of my other code and got it to actually work for what i need. My code:
Code:
FancyForm.start(0, {
		onSelect: function(chk) {		
			var url = 'schoolPage.php?catID=' + chk.inputElement.getProperty('id') + '&chk=' + chk.inputElement.getProperty('checked');
				var request = new Request({
					url:url,
					method:'POST',
					onRequest: function() {
						alert('making sure it works:: ' + url);
					}
				}).send();
			
			
		}
		
	});
so that works ....and if change it to onDeselect it works....when you uncheck a box....however i some how need them both in there....and so when you select or deselect the box that it will send the info. Being new to javascript I just can figure out the prop
Kay1021 is offline  
Reply With Quote