0

MVVM form validation for field inside template

asked 2016-07-19 20:12:01 +0800

HiteshR gravatar image HiteshR
1 2

Hi,

I am trying to validate my form using serverside validation. It is working fine with field but form also having list, I am rendering textbox for list using template. but for template validation is not working.

Please find below code.

<groupbox form="@id('fx') @load(vm.person) @save(vm.currentPerson, before={'save'}) @validator(vm.formValidator)" hflex="true" mold="3d"> <label style="font-weight:bold; color:#215891;" value="Test: "/> <groupbox> <grid hflex="true"> <rows>

                <row>
                    <label value="Name" />
                    <hlayout>
                        <textbox value="@bind(fx.name)"></textbox>
                    </hlayout>
                </row>
            </rows>
        </grid>
    </groupbox>

    <groupbox>
        <caption label="Address" />
        <grid model="@bind(fx.addresses)">
            <columns>
                <column width="100%" />
                <column />
            </columns>
            <template name="model">
                <row>
                    <grid>
                        <columns>
                            <column width="140px" />
                            <column />
                            <column width="120px" />
                            <column />
                        </columns>
                        <rows>
                            <row hflex="3">
                                <label value="address1" />
                                    <textbox value="@bind(each.address1)"></textbox>                    
                            </row>
                        </rows>
                    </grid>
                </row>
            </template>
        </grid>
        <button onClick="@command('addAddress',person=fx)" label="Add Address"/>

    </groupbox>

    <groupbox>
        <button label="Save"
            onClick="@command('save')">
        </button>
    </groupbox>

</groupbox>

Thanks, Hitesh

delete flag offensive retag edit
Be the first one to reply this discussion!
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2016-07-19 20:12:01 +0800

Seen: 22 times

Last updated: Jul 19 '16

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More