PDA

View Full Version : validation in lzx


mohan
09-16-2003, 07:25 AM
Hi Antun,
how can i do the validation in lzx .
In other internet application (JSP,PHP,ASP)we are using javascript or other scripting languages for client side as well as server side validation .Here how do i achieve this.


Thanks
Mallesh

antun
09-16-2003, 09:02 AM
One way to validate a form might be on the client. Something like this could work:


<canvas debug="true">
<simplelayout axis="y" spacing="3" />
<text>Please fill in all the fields:</text>

<inputtext name="foo"></inputtext>

<button>
<method event="onclick">
if ( foo.getText() == '' ) {
// User failed to fill out a form.
foo.setAttribute( 'bgcolor', 0xFFFF00 );
} else {
// Form field filled out; do a request or something.
}
</method>
</button>
</canvas>


That's a really simple example. You could also write your own text field component with a required attribute, that would register with an abstract form manager class oninit. Then when the form is submitted, the form mangager would go through the list of registered "required" fields and validate them.

It's also possible to validate on the server. I believe that was done in the case of the Pot Store that you can find on mylaszlo:

http://www.mylaszlo.com/lps-v1/pablo/store/store.lzx

There the information was sent back to the server, and then depending on the server's response the fields were highlighted.

-Antun

antun
09-17-2003, 10:22 AM
You might also want to have a look at this:

http://www.laszlosystems.com/developers/community/forums/showthread.php?s=&threadid=396

-Antun