IE6.x doesn’t work again with some Mootools code

Following my yesterday work, I have to add a new check on change event for the form in the script.

The idea is to send a request for each change in the form.
It’s easy to do it with Mootools, just add the addEvent() method
This code works fine with Firefox..and Co:

$('myform').addEvent('change', function() {        request.send($('myform'));});
BUT with Internet Explorer 6.x, it doesn’t work at all!
Yes again.. I know.

So, another way to get the same result is to use the magic function $$
With it, it’s easy to get all form elements to check their state (on change status)

$$('^myform_').addEvent('change', function() {        request.send($('myform'));});
Literally, we follow all the id elements starting by “myform_”, for example:
<input type="text" name="myform_text1" id="my_form_text1" />
Of course, you have to start all of your form elements name like this..
It’s not a problem for me, I do it by convention.
Advertisements

working day with Mootools.. find good tips here: http://davidwalsh.name blog

Well, a web dev day again today.
I looked for a solution to auto-update form in ajax.
I found solution here:
http://davidwalsh.name/periodical-ajax-requests-mootools-12
and here: http://davidwalsh.name/return-multiple-values-from-ajax-using-mootools
thanks to David 😉

I modified a bit the script to return form parameters in the ajax
request, here you are if you want it:

var request = new Request({        url: 'ajax.php',        method: 'post',        onComplete: function(fullresponse) {                var response= fullresponse.split('::');                $('result0').set('html',response[0]);                $('result1').set('html',response[1]);        }})var sendForm = function() {        request.send($('form3'));}sendForm.periodical(5000);