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

Making a control Required in Script Empty Making a control Required in Script

Thu 20 Dec 2018 - 15:29
Original post by Gareth Ahmun

I have been trying to make a control Required in script without success. Only when I navigate away from the particular page and back again does the field become required and the indicator shows.

Does anyone have any suggestions? It needs to be done in script as the controls will not always be required, it is dependent on the value of other controls on the page/wizard.

-----------------------------------------------------------------------------------------------------------------------------------------------------------
Original post by Daniel Thompson

Hi I have made a sample you can use...

Code:
Control c = EnquiryForm.GetControl("Name of Control");
System.Data.DataRow dr = this.EnquiryForm.GetSettings(c);
if (dr != null)
{
    dr["quRequired"] = true;
}

this.EnquiryForm.RenderControl(ref c, dr, "quRequired");

-----------------------------------------------------------------------------------------------------------------------------------------------------------
Original post by Mike Vaughan

Hi Daniel,I also needed to change the properties on a control in Script and I used the snippet you provided. I checked the properties of control ‘c’ and saw that I could set properties such as Enabled like so...

Code:
Control c = EnquiryForm.GetControl("cbxBrake");
c.Enabled = false;
this.EnquiryForm.RenderControl(ref c);

it seems to work, but can you see any reason why we should not go down this path to set control properties?

Also is there a difference between EnquiryForm.GetIBasicEnquiryControl2 and EnquiryForm.GetControl?

thanks

-----------------------------------------------------------------------------------------------------------------------------------------------------------
Original post by Daniel Thompson

I see your problem. Let me do some further investigation.

-----------------------------------------------------------------------------------------------------------------------------------------------------------
Original post by Gareth Ahmun

Thanks Daniel, your example works great.
Back to top
Permissions in this forum:
You cannot reply to topics in this forum