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...
-----------------------------------------------------------------------------------------------------------------------------------------------------------
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...
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.
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.
Permissions in this forum:
You cannot reply to topics in this forum
|
|