where to put addEvent-code to fire 'normal' onchange-event

361 views
Skip to first unread message

flat

unread,
Sep 23, 2009, 11:46:07 AM9/23/09
to MooTools Users
hi,

im using a mootools-based date-picker ( http://www.electricprism.com/aeron/calendar/
) but now my onchange-event on the textbox is not fired anymore.

This is my code:
<script type="text/javascript">
window.addEvent('domready', function() {
inc_shift_start = new Calendar({ inc_shift_start: 'd-m-Y' }, {
direction: 0,
}

);
inc_shift_start.addEvent('change', myOwnFunction() );
}
);
</script>

the myOwnFunction() is only called when i load the page and not when i
use the datepicker to select a date.
Anyone here knows about this stuff maybe? Thanks.

Fábio M. Costa

unread,
Sep 23, 2009, 12:48:16 PM9/23/09
to mootool...@googlegroups.com
window.addEvent('domready', function() {
        inc_shift_start = new Calendar({ inc_shift_start: 'd-m-Y' }, {
               direction: 0,
        });
        inc_shift_start.addEvent('change', myOwnFunction );}
);

The code should be like this, without the '()'. You were adding the return value from your function to the change event stack, now the code does what you want.

If it still doesnt work, you could read this:
http://www.meiocodigo.com/2009/08/13/new-changed-event/

The event doenst fire when you change the value from the text input using javascript, which should be the case when you use the calendar.


--
Fábio Miranda Costa
Solucione Sistemas
Engenheiro de interface

flat

unread,
Sep 24, 2009, 4:08:52 AM9/24/09
to MooTools Users
Hey,
thanks for the syntax-update. not so good with that yet.

if i add this Event.Changed.js from the website, my code would look
like this: "inc_shift_start.addEvent('changeD', myOwnFunction )" ?
cause that doesn't do anything so far :)


On Sep 23, 6:48 pm, Fábio M. Costa <fabiomco...@gmail.com> wrote:
> window.addEvent('domready', function() {
>         inc_shift_start = new Calendar({ inc_shift_start: 'd-m-Y' }, {
>                direction: 0,
>         });
>         inc_shift_start.addEvent('change', myOwnFunction );}
> );
>
> The code should be like this, without the '()'. You were adding the return
> value from your function to the change event stack, now the code does what
> you want.
>
> If it still doesnt work, you could read this:http://www.meiocodigo.com/2009/08/13/new-changed-event/
>
> The event doenst fire when you change the value from the text input using
> javascript, which should be the case when you use the calendar.
>
> --
> Fábio Miranda Costa
> Solucione Sistemas
> Engenheiro de interface
>
> On Wed, Sep 23, 2009 at 12:46 PM, flat <e...@samson-it.nl> wrote:
>

Fábio M. Costa

unread,
Sep 24, 2009, 8:15:30 AM9/24/09
to mootool...@googlegroups.com
If you didnt undertand the post its better for you to use the normal change event.
Do it work?



--
Fábio Miranda Costa
Solucione Sistemas
Engenheiro de interface


flat

unread,
Oct 1, 2009, 5:34:41 AM10/1/09
to MooTools Users
Hi Fabio,

no it doesn't work unfortunately. i added the changed.js to my
javascript-list, but to no avail.

but, what do you mean with this:
"The event doenst fire when you change the value from the text input
using
javascript, which should be the case when you use the calendar. "

Do you mean to say that events will never fire when i change the value
from the text-box using the javascript calendar?
If that's the case it won't work indeed.


On Sep 24, 2:15 pm, Fábio M. Costa <fabiomco...@gmail.com> wrote:
> If you didnt undertand the post its better for you to use the normal change
> event.
> Do it work?
>
> --
> Fábio Miranda Costa
> Solucione Sistemas
> Engenheiro de interface
>

Fábio M. Costa

unread,
Oct 1, 2009, 8:01:36 AM10/1/09
to mootool...@googlegroups.com
yeah, thats what i mean. The plugin should fix it for you, if it doest its a bug.
You could change its code to fire the event dou...
Or you could use another date-picker, ike this one, wich is the best for mootools IMO:
http://www.monkeyphysics.com/mootools/script/2/datepicker



--
Fábio Miranda Costa
Solucione Sistemas
Engenheiro de interface


Reply all
Reply to author
Forward
0 new messages