Hi there,

  If you let mason handle your javascript file, you can perfectly use
mason stuff inside it (here you would use <% $color %> in your
javascript file for instance) .

Assuming your component is withing one of  your mason root directory.

 - If you call it like '<& /js/validateForm.js , color => 'blue' &>
then mason will handle it as it was a normal mason component.

- Otherwise, if you want to call it like '<script
src="/js/validate.js?color=blue">' , then you have to do a bit of
apache configuration to tell apache to handle this ressource with
mason:

<LocationMatch "^\/js\/\.js$">
     SetHandler perl-script
     PerlHandler HTML::Mason::ApacheHandler
</LocationMatch>

This is actually how it works. You just tell apache to handle
ressources with mason. It can be .jpg , .html, .myext , .xml  , etc.
etc. . It doesn't matter (Well as long as mimetypes are set properly).

 To avoid slowing down plain static javascript serving, you may have
to change all your dynamic javascript to a 'dynjs' directory.

As well, you may want to add an autohandler that inherits from nothing
in your dynjs directory if you have a autohandler in your /


-  Alternatively, you may want to call validate.js validate.html so
you dont need to do any apache conf.


Hope it helps.

Jerome.



On Mon, Mar 2, 2009 at 11:15 AM, Shiladitya Biswas
<shiladitya.bis...@gmail.com> wrote:
> Hi,
> In my HTML file I am using a javascript like this:
> <script language="javascript" src="js/validateForm.js"></script>
>
> I want to pass a parameter to this file. Is there any way of doing this?
> The javascript file validateForm.js will receive parameter like this:
>
> <%args>
>        $color  => ''
> </%args>
>
> Thanks
> Shiladitya Biswas
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a $600 discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Mason-users mailing list
> Mason-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mason-users
>



--
Jerome Eteve.

Chat with me live at http://www.eteve.net

jer...@eteve.net



-- 
Jerome Eteve.

Chat with me live at http://www.eteve.net

jer...@eteve.net

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to