including user defined javascript function in GSP

1,779 views
Skip to first unread message

kouser neyaz

unread,
Apr 13, 2011, 8:59:58 AM4/13/11
to Indian Groovy & Grails User Group
Hello All,
I am new to Grails and getting some issues,i am unable to include
javascript
in gsp page.I would appreciate if any one could share code to call
javascript function from textField and calendar datePicker.I need to
call a
javascript function onblur() or onfocus() or any other user defined
function.
please let me know if you need any more clarification.
Thanks in advance

Gaurav

unread,
Apr 14, 2011, 7:56:04 AM4/14/11
to Indian Groovy & Grails User Group
Include the javascript file in your header.

<g:javascript src="myFile.js"/> //It must be inside js directory
otherwise use other forms of tag

Now you can easily call the functions you have defined inside your js
file.

Let us know if you face any issue.

Yagnesh Chawda

unread,
Apr 14, 2011, 9:54:20 AM4/14/11
to Indian Groovy & Grails User Group
Hey,
Please have look at http://www.dariopardo.com/grails/jquerydatepickergrailstag/
You can write the HTML in taglib inline into gsp if you ant fine
control because of any reasons. In that case you wont be using taglib.


Thanks And Regards,
Yagnesh Chawda.
: http://yagneshchawda.blogspot.com/
: http://twitter.com/yagneshchawda

***************************************************
Good planets are hard to find. Print less!
Save energy to keep your future bright !!
***************************************************
"Earth provides enough to satisfy every man's need,
but not every man's greed." - Mahatma Gandhi
***************************************************

On Apr 13, 5:59 pm, kouser neyaz <kouser.ne...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages