I've got round this now but im not sure if its a clean way...

Instead of observing one field i observe the whole form and have added
a checkbox.

I populate the hidden field with the form date and force a .click() on
the check box which triggers the ajax and i get my results.

Does anyone know a better way of triggering ajax from javascript
rather than through php $ajax->observeForm?

Cheers,
Chris

On Mar 12, 3:44 pm, Bailey <baileys...@gmail.com> wrote:
> I've done some further research on this...
>
> I don't think the ajax->observeField method is picking up the change
> because when my javascript is changing the DOM its not registering
> that change.. even though its happened.
>
> I've looked at other various ajax methods like remoteTimer but not
> sure how i could get the value out of a form element to send to the
> ajax update function..
>
> any ideas?
>
> Cheers,
> Chris
>
> On Mar 12, 1:57 pm, Bailey <baileys...@gmail.com> wrote:
>
> > Hi all,
>
> > Sorry for the longwinded subject header :-) wasn't sure how else i
> > could sum up my issue.
>
> > I'm trying to run some ajax that will update a div and the way I am
> > doing this is with observe field.
>
> > Heres how i'm trying to do it:
>
> > 1. Javascript function is called which updates a hidden form element
> > with a date
> > 2. Form element is being observed using $ajax->observeField('fieldID')
> > which updates a div
> > 3. The observe field calls a function in my controller that echo's out
> > new information based on the date to that div.
>
> > Now, my form field is being populated from a 'null value to a text
> > value (i.e. "21,03,2010"), and this is happening fine, its occuring
> > when i click on elements of a calander i have. I've used javascript to
> > send the 'date' to this hidden field as i thought it would be better
> > to observer only 1 field, rather than hundreds of elements that
> > represent days in a calendar.
>
> > My problem is that although the form field updates just fine to the
> > correct date it doesnt initialise the observeField function.. rather,
> > ajax doesn't recognise the change.
>
> > I'm relatively new to ajax and enjoying it but this is becoming a bit
> > frustrating.. i don't like the idea of trying to 'trick' the ajax into
> > working so i'd be very appreciative if someone could guide me to a
> > better means of what im trying to accomplish here.
>
> > Many thanks for all your advice,
> > Chris

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to