Hi,

I'm struggling with form input and different javascript that needs to
be triggered depending on successfully validated form info and info
that does not validate.

First, the view I have is both an add entry form AND a records overview
in one page.
When a record is added with the form it adds to the database and the
div is updated (the overview record list gets a new record), all with
ajax. I do this with a $ajax->submit('add record', array('url' =>
'/records/add', 'complete' => 'some scriptaculous highlight effect');

This works, BUT, the two issues here are:

- Formfields aren't cleared after successfull submission, so I will
need to use prototypes Field.clear('formfieldid')
- The scriptaculous highlight also appears when the data does not
validate (which is logical as it is added to the complete option).

So I thought, let's use the success and failure options. But these
don't seem to work!
So if I change the submit into: $ajax->submit('add record', array('url'
=> '/records/add', 'success' => "some scriptaculous highlight effect;
Field.clear('formfieldid');", 'failure' = "Some other javascript");

So I wonder when/how the success and failure option is triggered, do I
need to set something for it in the controller?

-------------

Since I didn't get this to work, I thought, I'd write some custom
javascript for it. But for some bizarre reason all script tags are
stripped from my views?????!!!!!!!!

So when adding this:

echo $javascript->codeBlock('some javascript');

or just the plain javascript

<script language="JavaScript">some javascript</script>

to my view (add.thtml) it does NOT show up in the resulting
html????????????????

Is this some Cake security setting which I need to change??


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Cake PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to