This is a migrated thread and some comments may be shown as answers.
New Form - Bool fields handling
4 Answers 15 Views
This is a migrated thread and some comments may be shown as answers.
Bas
Top achievements
Rank 1
Bas asked on 05 Jun 2020, 12:50 PM

I have a couple of issues with using bool fields on the new Form.
1.Why a bool field is automatically a required field? How to make it so that it can be on or off?
2. On submit bool fields are set with 'on' for true, what am I doing wrong?

 

....
item.Add()
   .Field(f => f.MakeExtensions)
   .Label(l => l.Text("Make Extensions"))
   .Editor(e =>
    {
          e.Switch().Messages(c => c.Checked("YES").Unchecked("NO"));
     });
....

 

If the field is uncheck, then validation fails, but when I check it I get the following in the form header on submit:

....
Id: 14
Secret:
MakeExtensions: on
RunningState: 0
....

4 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 09 Jun 2020, 10:30 AM

Hеllo Bas,

To answer your two questions directly:

1) Making the boolean as optional can be achieved by setting the related model field as nullable bool (MakeExtensions).

2) The value is incorrectly submitted and is related to a bug in the Form functionality. This is already logged and you can start tracking the progress on the issue form the following item:

Due to the complexity of the issue, I am not able to provide a viable workaround at the moment. The recommended approach is to monitor the issue in order to get notified as soon as the status of the item changes.

Regards,
Dimitar
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Bas
Top achievements
Rank 1
answered on 22 Jun 2020, 05:13 PM

The boolean value on the form has been fixed with 2020.2.617; however, Switch editor widget still does not work.
My original reported scenario still does the same thing. Actually its even worse because all the DropDownList() are failing with the Switch widget!

0
Accepted
Dimitar
Telerik team
answered on 23 Jun 2020, 08:56 AM

Hello Bas,

I can confirm that the fix for the discussed issue with the checkboxes/Switch was not included in the latest Service Pack (2020.2.617) due to the need of additional time for testing. I noticed that the Feedback Portal item has incorrectly tagged the issue for R2 SP1 and I would like to apologize if the GitHub for the misleading information. The tag will be updated accordingly.

Tomorrow 24th of June, an internal build will be released where the fix for the issue will be included. Internal builds are available for download from your Telerik Profile and the version of the release in question will be 2020.2.624. Taking this into consideration, may I ask you to test the internal version after it is released and confirm if the issues with the Switch is resolved?

I am looking forward to hearing from you.

Regards,
Dimitar
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Bas
Top achievements
Rank 1
answered on 25 Jun 2020, 04:23 PM
Thanks Dimitar.
I can confirm that the internal build 2020.2.624 fixed my original problems. I was able to test all my scenarios successfully.
Tags
Form
Asked by
Bas
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Bas
Top achievements
Rank 1
Share this question
or