You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jorge Quiroga <jq...@pctltda.com> on 2006/01/20 22:40:03 UTC
Newbie T4 Javascript question
Hello:
I'm newbie with T4 and I'm trying to do a component that is composed by
a Checkbox, Label, A dynamic input control (could be a text, validtext,
a checkbox or a combo) and a button.
The checkbox if is present, enable/disabled via javascript the button
and the dynamic input control. By now the component generates the
Javascript but when the component is called by a For then I don't know
how to obtain the function name corresponding in the HTML code (to
control the enabled disabled via on focus over the dynamic component and
the by the enabled informal parameter of the button) and the T4
documentation and the Tapestry in action book doesn´t spotlight for this
case.
The .script involved part is:
<script>
<input-symbol key="check" class="org.apache.tapestry.form.Checkbox"
required="no"/>
<set key="chkName" expression="check.name"/>
<let key="ctrlEnabled" unique="yes">
enableCtrlChecked_${chkName}
</let>
<let key="CheckCheckBox" unique="yes">
isCheckChecked_${chkName}
</let>
<body>
<if expression="not (chkName==null)">
<![CDATA[
function ${CheckCheckBox}()
{
if (!${chkName}.checked)
${chkName}.focus()
}
function ${ctrlEnabled}()
{
if (${chkName}.checked)
return true;
else return false;
}
]]>
</if>
</body>
</script>
and the HTML into the component is:
<table border="1" cellspacing="0">
<tr>
<td>
<span jwcid="@If" condition="ognl:showCheckbox">
<span jwcid="enableCtrl@Checkbox" value="ognl:checkEnabled"/>
</span>
<span class="labelClass" jwcid="@Insert" value="ognl:displayName"/>
</td>
<div jwcid="comp@RenderBlock" block="ognl:inputType"/>
<block jwcid="alfanumeric@Block">
<td>
<span jwcid="alfa@TextField" value="ognl:valor"
size="ognl:inputSize" onfocus="HOW_I_CAN_DO_IT"/>
</td>
<span jwcid="@If" condition="ognl:showButton">
<td>
<input type="button" jwcid="@Any" value="..." onClick='return
nwl_popWindow(+dialogURL+","+dialogWidth+","+dialogHeight+","+dialogCentered+","+dialogFeatures+","+dialogTitle+");"'
enabled='HOW_I_CAN_DO_IT'/>
</td>
</span>
</block>
... other blocks
</tr>
</table>
<span jwcid="@If" condition="ognl:showCheckbox">
<span jwcid="@Script" script="CheckedLookupDialog.script"
check="ognl:components.enableCtrl"/>
</span>
<span jwcid="@Else">
<span jwcid="@Script" script="CheckedLookupDialog.script"/>
</span>
I have too problems with escaping " and ' with the OnClick on the button
Thanks for your time.
JQ
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org