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 by the enabled informal parameter of the button) and every dynamic Input Component reacts only with the last dynamically generated js function and not with its correspond function, I search into the T4 documentation and the Tapestry in action book but doesn´t spotlight for this case and I saw some code of the Popup component, but I don´t understand it well (how to obtain the function name and attach it into de HTML or how calculate the function name if I don´t know how to obtain the real name of the component) and using the same approach in the java code I obtain the same result.

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="[EMAIL PROTECTED]" value="ognl:checkEnabled"/>
  </span>
  <span class="labelClass" jwcid="@Insert" value="ognl:displayName"/>
</td>
  <div jwcid="[EMAIL PROTECTED]" block="ognl:inputType"/>
    <block jwcid="[EMAIL PROTECTED]">
      <td>
<span jwcid="[EMAIL PROTECTED]" 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>

the .java is a POJO with abstracts getters and setters and as I said the getFuntionName (as PopupLink is) for focus and enabled doesn´t work and isn´t relevant.

I'm attack the problem in the wrong way? or I'm missing something?

Thanks for your time, and excuse me for re-send it.

JQ


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to