locked
Clear the fields after submission RRS feed

  • Question

  • Hi,

    I am developing a form in SL4, where the fields are submitted. I am using MVVM pattern with Validation. I want to clear the fields once I submit the data. The problem is that the validation errors pops if I try to nullify or clear the properties.

    Please help me for the same

    Friday, April 23, 2010 4:18 AM

Answers

  • Hi,

       Sorry to say that, but maybe it's not a good practice to clear the value after submit.

       What the business application do is show a busy indicator to tell the user it's submiting and waiting for response.

       If success , it will redirect him to the mainpage. If faild , show the regristration form and display data the user entered before so that he could edit directly.

       This is what I will do as well.

       Back to your problem.  You may try not use twoway binding so that it will not automatically change data source. Therefore the validation wont occur. You can use binding expressions to update the source manually.

    Best Regards

    Tuesday, April 27, 2010 2:46 AM

All replies

  • Mmmm....

       The idea is to let the user enter a new entry?

        What' do you fill when the user wants to create a new entry?

        One option could be disable validations on control (I guess NotifyErrors to false or something like that) to have a flag in your entity that would disable that check (youn add it using partial classes), or changing the binding.

       Mmm... maybe that solution are not quite good, can you explain further the scenario / use case that you are facing?

    Thanks

      Braulio

     

    Friday, April 23, 2010 6:17 AM
  • I want to fill my registration form & submit. Once the form is submitted I want to show a message and clear the form fields

    Friday, April 23, 2010 1:45 PM
  • Hi,

       Sorry to say that, but maybe it's not a good practice to clear the value after submit.

       What the business application do is show a busy indicator to tell the user it's submiting and waiting for response.

       If success , it will redirect him to the mainpage. If faild , show the regristration form and display data the user entered before so that he could edit directly.

       This is what I will do as well.

       Back to your problem.  You may try not use twoway binding so that it will not automatically change data source. Therefore the validation wont occur. You can use binding expressions to update the source manually.

    Best Regards

    Tuesday, April 27, 2010 2:46 AM