I have a need to access a validatingForm button directly, like I can do
with a form button. Below you'll find a sample file that shows the
problem. I can access the button directly if I globally replace
"validatingForm" with "form" and use the base class, however, I lose the
capability to use Togwa's great validating classes, which I need for my
end goal.
If you run the code below, just press the "Next" button and you should
get page2 loaded and the "Back" button should be enabled. That's the
goal, anyway. If you change validatingForm to form, it works that way.
How do you access buttons in the buttonplace of a validatingForm? I've
tried everything I can think of (i.e. all the obvious pathing options
like canvas.theWin.myform.btnBack, etc.).
Thanks,
Bret
------------------
<canvas debug="true" height="530">
<include href="formlayout.lzx" />
<include href="validators/validatingform.lzx"/>
<method name="doBackAction" args="onPage">
<![CDATA[
if (onPage == "page2") {
theWin.page1.apply();
theWin.page2.remove();
}
]]>
</method>
<method name="doNextAction" args="onPage">
<![CDATA[
if (onPage == "page1") {
theWin.page1.remove();
theWin.page2.apply();
}
]]>
</method>
<method name="page1Applied" >
<![CDATA[
Debug.write("page1 applied");
]]>
</method>
<method name="page1Removed" >
<![CDATA[
Debug.write("page1 removed");
]]>
</method>
<method name="page2Applied">
<![CDATA[
Debug.write("page2 applied");
btnBack.setAttribute("enabled",true);
]]>
</method>
<method name="page2Removed">
<![CDATA[
Debug.write("page2 removed");
btnBack.setAttribute("enabled",false);
]]>
</method>
<window name="theWin" resizable="false" bgcolor="0x7A8BE9"
width="750" height="300">
<state name="page1" apply="true"
onapply="canvas.page1Applied()" onremove="canvas.page1Removed()">
<simplelayout axis="x"/>
<validatingForm width="600" height="250"
name="myform" >
<simplelayout axis="y"/>
<submit name="submit" />
<text>Page1</text>
<button name="btnSet"
enabled="true" text="Test Data" onclick="canvas.setTestData()"/>
<button id="btnBack"
name="btnBack" enabled="false" text="Back"
onclick="canvas.doBackAction('page2')"/>
<button id="btnNext" name="btnNext"
enabled="true" text="Next" onclick="canvas.doNextAction('page1')" />
<button name="btnCancel"
enabled="true" text="Cancel" onclick="canvas.reset()"/>
</validatingForm>
</state>
<state name="page2" onapply="canvas.page2Applied()"
onremove="canvas.page2Removed()">
<validatingForm width="600" height="250"
name="myform" >
<simplelayout axis="y"/>
<submit name="submit" />
<text>Page2</text>
<button name="btnSet"
enabled="true" text="Test Data" onclick="canvas.setTestData()"/>
<button id="btnBack"
name="btnBack" enabled="false" text="Back"
onclick="canvas.doBackAction('page2')"/>
<button id="btnNext" name="btnNext"
enabled="true" text="Next" onclick="canvas.doNextAction('page1')" />
<button name="btnCancel"
enabled="true" text="Cancel" onclick="canvas.reset()"/>
</validatingForm>
</state>
</window>
</canvas>
_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user