You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by zqzuk <zi...@hotmail.com> on 2006/08/08 18:15:23 UTC

call javascript method on button click

Hi, i wonder how can i do this. in my html template, i have a button, on
click a javascript method will be called, and fill some form components.
this method should not submit the page. all work fine in plain html.

then when i do this in tapestry, i got problems.  if i dont give this button
compoent a jwcid as such,

<input type="button" name="calcTotalButton" value="Calculate"
onClick="calcTotals()"/>

as it works in original html template, tapestry wont render the button, so i
end up with a page without this button. 


well then i added a jwcid to this component and specify it as a Button ( i
can not be submit), i got this error:

<input type="button" name="calcTotalButton" value="Calculate"
onClick="calcTotals()" jwcid="calcTotalButton"/>

org.apache.tapestry.parse.TemplateParseException
Tag <input> on line 373 is a dynamic component, and may not appear inside an
ignored block.


is there anyway i can get around with this? how can i make call to a
javascript method on button click?

thanks!!
-- 
View this message in context: http://www.nabble.com/call-javascript-method-on-button-click-tf2073678.html#a5709887
Sent from the Tapestry - User forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: call javascript method on button click

Posted by zqzuk <zi...@hotmail.com>.
thanks. 
-- 
View this message in context: http://www.nabble.com/call-javascript-method-on-button-click-tf2073678.html#a5717389
Sent from the Tapestry - User forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: call javascript method on button click

Posted by ro...@scazdl.org.
1)Tapestry will normally render whatever you put, so there's no issue with
having the button w/out a jwcid attribute. That's barking up the wrong
tree.
2)The error that you're getting when you put jwcid says that the component
is in an ignored block of text.
Here are some examples of ignored blocks of text:
1) i18n:
<span key="str_msg">This text is ignored; it will be replaced by the text
associated with the i18n key str_msg</span>This text is NOT in an ignored
block.
2) inserts:
<span jwcid="@Insert" value="ognl:someValue">This text is placeholder;
it's ignored by tapestry</span>This text would render
3) Other components that don't render their body, including:
  contrib:Table
  <table jwcid="@contrib:Table" source="ognl:list" columns="a,b,c">
    <tr><td>The tr and td's I'm specifying here wont' render</td>
        <td>Or here</td>
        <td>Or here</td>
    </tr>
  </table>
  This text will render

So, check to see what tags/components are surrounding your button, and
whether or not they allow a body.

Robert
>
> hi, after done some search, it seems that $remove$ is not what i should
> use,
> cuz it removes the contents within. i want tapestry to render a component
> exactly as it is defined in the template, ie
>
> in template, i have
>
> <input type="button" name="calcTotalButton" value="Calculate"
> onClick="calcTotals()"/>
>
> and i want tapestry to render this line exactly in the result page.
> apparently if i dont identify it using jwcid, tapestry wont render this
> line
> at all.
>
> any idea please, thanks!
>
> --
> View this message in context:
> http://www.nabble.com/call-javascript-method-on-button-click-tf2073678.html#a5716741
> Sent from the Tapestry - User forum at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: call javascript method on button click

Posted by zqzuk <zi...@hotmail.com>.
hi, after done some search, it seems that $remove$ is not what i should use,
cuz it removes the contents within. i want tapestry to render a component
exactly as it is defined in the template, ie

in template, i have

<input type="button" name="calcTotalButton" value="Calculate"
onClick="calcTotals()"/>

and i want tapestry to render this line exactly in the result page.
apparently if i dont identify it using jwcid, tapestry wont render this line
at all.

any idea please, thanks!

-- 
View this message in context: http://www.nabble.com/call-javascript-method-on-button-click-tf2073678.html#a5716741
Sent from the Tapestry - User forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: call javascript method on button click

Posted by zqzuk <zi...@hotmail.com>.
hi thanks. no i dont have that .... sorry im a newbie, er... how exactly do i
use that please? where should i put jwcid=$remove$?

any hints please, thank you.
-- 
View this message in context: http://www.nabble.com/call-javascript-method-on-button-click-tf2073678.html#a5716078
Sent from the Tapestry - User forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: call javascript method on button click

Posted by Jason Dyer <jd...@bluetarp.com>.
You don't have a jwcid="$remove$" somewhere on that page, do you?  That's the 
only way I've gotten that message and it would explain why your simple input 
button wasn't being rendered, as well.

On Tuesday 08 August 2006 12:15, zqzuk wrote:
> Hi, i wonder how can i do this. in my html template, i have a button, on
> click a javascript method will be called, and fill some form components.
> this method should not submit the page. all work fine in plain html.
>
> then when i do this in tapestry, i got problems.  if i dont give this
> button compoent a jwcid as such,
>
> <input type="button" name="calcTotalButton" value="Calculate"
> onClick="calcTotals()"/>
>
> as it works in original html template, tapestry wont render the button, so
> i end up with a page without this button.
>
>
> well then i added a jwcid to this component and specify it as a Button ( i
> can not be submit), i got this error:
>
> <input type="button" name="calcTotalButton" value="Calculate"
> onClick="calcTotals()" jwcid="calcTotalButton"/>
>
> org.apache.tapestry.parse.TemplateParseException
> Tag <input> on line 373 is a dynamic component, and may not appear inside
> an ignored block.
>
>
> is there anyway i can get around with this? how can i make call to a
> javascript method on button click?
>
> thanks!!

-- 
QOTD:
	On a scale of 1 to 10 I'd say...  oh, somewhere in there.
--------------
Jason Dyer
BlueTarp Financial, inc.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org