[Laszlo-dev] client-side Form Validator

togawa manabu togawamanabu at yahoo.com
Sun Nov 6 04:44:21 PST 2005


Hi everyone;

Because I needed it for validating form at the
client-side. I made something for easily validating
some inputs.

you can use this components like the following
examples.

<canvas>
    <include href="/validators" />
    <include href="formlayout.lzx" />
    
    <validatingForm name="myform">
        <submit name="submit" />
        
        <formlayout spacing="10" />
        
        <text>name(5~20 chars):</text>
        <stringvalidator required="true" minLength="5"
maxLength="20">
            <edittext name="name" />
        </stringvalidator>
        
        <text>E-mail:</text>
        <emailvalidator required="true">
            <edittext name="e-mail" />
        </emailvalidator>
        
        <text>birthday(mm/dd/yyyy):</text>
        <datevalidator format="mm/dd/yyyy">
            <edittext name="birthday" />
        </datevalidator>
        
        <text>birthday2(yyyy/mm/dd):</text>
        <datevalidator format="yyyy/mm/dd">
            <edittext name="birthday2" />
        </datevalidator>
        
        <text>number(-10 ~ 100):</text>
        <numbervalidator domain="int" minvalue="-10"
maxvalue="100">
            <edittext name="number" />
        </numbervalidator>
        
        <button text="OK"> 
            <method event="onclick">
                <![CDATA[
                    var rtn = myform.doValidation();
                    if( rtn ){
                        myform.submit.submit();
                        Debug.write("ok - submited");
                    }else
                        Debug.write("validation
error");
                ]]>
            </method>
        </button>
    </validatingForm>
</canvas>

I put source-code and swf-file on the wiki.
http://laszlo.jp/wiki/index.php?%A5%AB%A5%B9%A5%BF%A5%E0%A5%B3%A5%F3%A5%DD%A1%BC%A5%CD%A5%F3%A5%C8#j5732423

-------------------------------------------
[[Togawa Manabu]]
e-mail    : webmaster at laszlo.jp
LaszloJapan : http://laszlo.jp



		
__________________________________ 
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com


More information about the Laszlo-dev mailing list