Your syntax for calling your js looks okay. Instead of keeping the js in the
same .ctp (it won't be accessible from other views, etc.) place it in it's
own .js file such as "myJsFunctions.js" and store the file in app/webroot/js
folder then include it in your default.ctp via
$html->script(array('myJsFunctions)); Your functions within that file will
be accessible throughout your app.

- Ed

On Wed, Apr 28, 2010 at 4:44 AM, rakeshyadav rakeshyadav <
[email protected]> wrote:

> Hi all,
>          i am trying to call javascript functions from my cake view file
> (eg.. onclick,onload ) . i want what is the proper syntax to call javascript
> and where i want to put my javascript file .
>
>
>    <?php echo $html->link('Admin Store Group', '#',
>
> array(
>
> 'class'=>'url2_font',
>
> 'font-fomily'=>'Verdena',
>
> 'onclick' => 'edit_store()'));
>                                                 ?>
>
> i try to call javascript with the syntax as above and kept my js code in
> same ctp file is it correct please let me
>
>
>  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 [email protected]
> To unsubscribe from this group, send email to
> [email protected]<cake-php%[email protected]>For
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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 [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