Mattersphere Developers Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Go down
avatar
Admin
Admin
Posts : 122
Join date : 2018-12-17
https://mattersphere-devs.forumotion.com

Validate a Page Empty Validate a Page

Mon 27 Jan 2020 - 17:32
Hi,
Is there any way to validate a wizard page at a time i.e. when next page button is clicked validate the current page before proceeding?

Thanks,Gareth
________________________________________________________________________________________________________________________________
Add this Code to the PageChanging Event
Code:

if (e.Direction == EnquiryPageDirection.Next)
{
    foreach (Control ctrl in this.EnquiryForm.Controls)
    {
        if (ctrl.Visible)
        {
            System.Data.DataRow dr = EnquiryForm.GetSettings(ctrl.Name);
            if (dr != null && Convert.ToBoolean(dr["quRequired"]))
            {
                if (Convert.ToString(EnquiryForm.GetIBasicEnquiryControl2(
                    ctrl.Name,EnquiryControlMissing.Exception).Value) == "")
                {
                    EnquiryForm.ShowMissingField(ctrl,"Required field");
                    e.Cancel = true; return;
                }
            }
        }
    }
}
This will stop the Next Button from changing page and will highlight the Controls that will be required
Hope this helps
______________________________________________________________________________________________________________
That is great, thanks very much.
Gareth
Back to top
Permissions in this forum:
You cannot reply to topics in this forum