You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by sa...@women-at-work.org on 2005/01/25 21:32:49 UTC

JavaScript

What would be the quickest way to get a javascript within a html template
working? The rendered html page contains $TextArea for the single textarea
field within that particular page. So if I use $TextArea would the
javascript pick it up or get muddled up because of the $ sign ?

<SCRIPT type="text/javascript">

<!--


function check(form) {
        leng=form.$TextArea.value.length;
        if (leng>800) {
form.$TextArea.value=form.$TextArea.value.substring(0,800); remain=0; 
                      } 

                else  { remain=800-leng;
                      }
        form.leng.value=remain;
}


-->
</SCRIPT>

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


Re: JavaScript

Posted by ca...@ocean7.com.
The form element names generated by tapestry should
not be copied into the javascript like that. Because you
don't control them. Some form components allow us to
specify an html id attribute, others don't. In the latter
case i see no way than to ask the component for its
name.

(AbstractFormComponent) formComp.getName()

using a Map we can now pass the name via the
symbols attribute to the Script

form.${componentName}.value



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