hello
you can customize the flash to produce a js alert.
create a layout flash.ctp (copy the one in /cake/libs/view/templates/
layouts/flash.ctp)
instead of echo $message, put:
<script type="text/javascript">
alert('<?php echo str_replace('\'', '\\\'', $message) ?>'); //
str_replace to avoid ' (quote)
// and any javascript you need
// $url contain the redirection url, to redirect you can do:
location.href = '<?php echo $url ?>';
</script>
maybe some typos, I didn't test this code
On 6 fév, 12:41, "Ilafra" <[EMAIL PROTECTED]> wrote:
> I know... but I need to call a javascript function also in another
> point of my code, always after the a data adding in my database and
> after the checking in the controller.
> I try to explain you better.
> I have some objects, like dots, and when a user clicks on them a popup
> (like that of google map) appears to show information about the
> clicked object.
> I create this popup with javascript and I fill it with a view
> requested by an XMLHttpRequest.
> In the popup the user has to be able to modify this information and
> using a cake view the data are saved in the database.
> Now I would like to recall the popup with the updated information to
> give a feedback to the user but in order to do that I should call my
> javascript function from a controller method.
>
> Do you think that it is possible?
> Thank you very much.
>
> On Feb 5, 5:47 pm, "AD7six" <[EMAIL PROTECTED]> wrote:
>
> > On Feb 5, 4:39 pm, "Ilafra" <[EMAIL PROTECTED]> wrote:
>
> > > hi guys,
>
> > > I'd like to show a little pop-up in oder to inform the user that an
> > > operation (like "edit" or "add" data) has been correctly executed and
> > > to include in the pop-up an "Ok" button that redirects the user to the
> > > view that I wish.
> > > I know that CAKE allows to this by the flash() method but it renders a
> > > new view and not a little "pop-up"as I want.
> > > I thought to realize the pop-up using a simple javascript alert, but i
> > > don't know how to call the execution of this javascript in the view. I
> > > don't understand which is the event to associate in order to show the
> > > alert because the save operation is done in the controller.
>
> > > Any suggestions!?
>
> > Your site visitors would thank you if you didn't do that.
>
> > Cheers,
>
> > AD7six
> > Please note:
> > The manual/bakery is a good place to start any quest for info.
> > You may get your answer quicker by asking on
> > the IRC Channel (you can access it with just a browser
> > here:http://irc.cakephp.org).
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---