T4: including javascript in a component

2009-12-30 Thread Ivano Luberti
Hello, I'm trying to include some simple javascript in a component in my T4 application. I want my only textfield to get focus when is displayed. I'm following the instructions provided at: http://tapestry.apache.org/tapestry4.1/components/general/script.html The template of the page including

Re: T4: including javascript in a component

2009-12-30 Thread Andreas Andreou
Hi, The error message says that something.getName() is trying to get evaluated but something is null Finding where exactly the error is thrown will show you which object is null... On Wed, Dec 30, 2009 at 20:51, Ivano Luberti lube...@archicoop.it wrote: Hello, I'm trying to include some simple

Re: T4: including javascript in a component

2009-12-30 Thread Ivano Luberti
Thanks Andreas , the problem is that everything works until I insert the javascript. In fact the exception is thrown inside the Script implementation. Down here you'll find the init part of the srtack trace. I was wondering if not using the @Body in the component html template is correct, given

Re: T4: including javascript in a component

2009-12-30 Thread Andreas Andreou
You don't specify which object you've found to be null... but anyway, let me try... looking at the FormFocus.script code from http://tapestry.apache.org/tapestry4.1/components/general/script.html i see ${component.form.name} and ${component.name}, so either component or component.form is null

T4: including javascript in a component (solved)

2009-12-30 Thread Ivano Luberti
Actually the error was in the html template of the component: The @Script refers to the text field component barCode but it is written before the the component itself. Hence when the file is parsed the the text field component doesn't exist yet. I have put the Scrtp declaration after the /form tag

Re: T4: including javascript in a component

2009-12-30 Thread Ivano Luberti
I have wrote the solution I have found before reading this. Actually It was enough to put it after the form. The null component was the text field component not the Form. You almost got it because sure the position of @Script matters. It seems that getForm returns something even if the form has

Re: T4: including javascript in a component

2009-12-30 Thread Ivano Luberti
Correction: putting the @Script solved the null pointer but the generated javascript was incorrect. I had to put it before the end of the Form. You were right Andreas Ivano Luberti ha scritto: I have wrote the solution I have found before reading this. Actually It was enough to put it after the