1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Adding Required Checkbox on Custom Form Control

Adding Required Checkbox on Custom Form Control

12 posts, 0 answered
  1. Mayvelous
    Mayvelous avatar
    43 posts
    Registered:
    26 May 2011
    15 Sep 2011
    Link to this post
    Hello,

    I've created a dropdown list custom Form control following this example:
    http://blog.falafel.com/blogs/11-03-14/Creating_Custom_Form_Controls_in_Sitefinity_4_0.aspx

    I want to add "Required" checkbox to make the dropdown field required like those of the built-in form controls. Or at least make it as required field without any checkbox option on the designer.
     
    I tried to set the "Required" property of ValidatorDefinitions to True as in this example but it doesn't validate at all. http://blog.falafel.com/blogs/11-02-27/Input_Validation_on_Sitefinity_4_0_Forms.aspx but it didn't work for my dropdownlsit.

    Could someone guide me how to add a required field checkbox or just to make the field required to custom Form control please.

    Thanks.
  2. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    19 Sep 2011
    Link to this post
    Hello Mayvelous,

    I think that the Required field works but the dropdown form element is such an element that actually always has a selected value, because the title and the value are the same, so "-- Select country --" is a valid selected choice.

    Did you try for example with a radio button list or a custom textbox?

    Greetings,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Mayvelous
    Mayvelous avatar
    43 posts
    Registered:
    26 May 2011
    20 Sep 2011
    Link to this post
    I'm not quite understanding your reply.
    My dropdownlist was custom build form control and it has different text and value fields. For "-- Select Country --" field, the value is null string "".
    I just want to add "Make required" checkbox and the error message field like those in the built-in textbox form control and how that validation is done via JS or in the form control code.
    Any help on how to go about please?

    Thanks.
  4. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    20 Sep 2011
    Link to this post
    Hi Mayvelous,

    In this case I will need the source of your custom form control so I could see what is going on. Could you send it to us?

    Kind regards,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Mayvelous
    Mayvelous avatar
    43 posts
    Registered:
    26 May 2011
    21 Sep 2011
    Link to this post
    Please download the project file from here: http://www.mediafire.com/?b4onqrl7q0bn7om [11kb]
    Thanks.
  6. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    22 Sep 2011
    Link to this post
    Hi Mayvelous,

    Just a quick question - if you drop a regular drop down list control could you see all its settings under Advanced and copy them to your control - I especially talk about the Validator setting - it must be set to "Telerik.Sitefinity.Web.UI.Validation.Validator". Then, if you write your own DropDown field control why don't you inherit directly from FormMultipleChoice instead of FieldControl - that way most of the logic will be ready out of the box that way.

    Best wishes,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Mayvelous
    Mayvelous avatar
    43 posts
    Registered:
    26 May 2011
    23 Sep 2011
    Link to this post
    Hi Lubomir,

    The Validator setting is the same as you mentioned and so as many other fields.
    Thanks for the hint to use FormMultipleChoice but I wanted as dropdown list item and not multiple choice radio buttons so I'm inheriting from FormChoiceField instead and following the sample here
    I'm still having some problems and am asking for help in the other post.

    Thanks.
  8. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    28 Sep 2011
    Link to this post
    Hi Mayvelous,

    In this case can we consider your issue as resolved or you have any more issues?

    Kind regards,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. Mayvelous
    Mayvelous avatar
    43 posts
    Registered:
    26 May 2011
    28 Sep 2011
    Link to this post
    It's still not working for me and I don't get any proper respond on my error I posted in the other post so I don't know whether to close this or not.
  10. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    28 Sep 2011
    Link to this post
    Hi Mayvelous,

    What is your other post? We should stick to only one place where we answer your questions so please choose one of the two threads to be the active one and we will close the other one.

    Best wishes,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  11. Mayvelous
    Mayvelous avatar
    43 posts
    Registered:
    26 May 2011
    29 Sep 2011
    Link to this post
    As mentioned above, it's here: http://www.sitefinity.com/devnet/forums/sitefinity-4-x/sdk/dynamic-dropdown-choicefieldelement-in-custom-module.aspx#1812716

    Should I repost whatever I've posted there in this thread cos' that thread has been closed.
  12. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    30 Sep 2011
    Link to this post
    Hi Mayvelous,

    I would suggest to send your entire custom form control project in a new support ticket. The exception that you mentioned in your other forum thread might be coming from something else in your source that we can't see at the moment.

    Greetings,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
12 posts, 0 answered