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

Forums / Developing with Sitefinity / Multiple custom form controls within a single usercontrol

Multiple custom form controls within a single usercontrol

2 posts, 0 answered
  1. Tony
    Tony avatar
    29 posts
    Registered:
    30 Dec 2010
    08 Aug 2011
    Link to this post
    I am attempting to extend the example found at the link below.
    http://blog.falafel.com/blogs/peterkinmond/11-03-14/Creating_Custom_Form_Controls_in_Sitefinity_4_0.aspx

    I would like to have a group of textboxes with pre populated data that would be placed on a page with a single control from the toolbox. So far I can have multiple input controls display on the rendered form, however the values are not persisting to the DB and are not being reflected in the responses recorded from the form submission.

    Anyone have any insight as to what is missing to get this behavior? Is it even possible or will I have to have each pre populated text box a separate control in the forms toolbox?

    Thanks,

    Tony

  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    11 Aug 2011
    Link to this post
    Hello Tony,

    The controls on a form control act as a filed setter. for example if you create a form with 3 of the out of the box text inputs it will create 3 fields (columns) in the table for this form which will store the input. When building a custom widget for the forms module and you want it to to store the values of each textbox in the same field you will have to combine the input in the bellow JS methods:
    // Gets the value of the field control.
    get_value: function () {
       //here get the input from all textboxes and format the input string
        return this._textbox.get_value();
    },
     
    // Sets the value of the text field control depending on DisplayMode.
    set_value: function (value) {
        //parse the value so that you can populate each textbox
        this._textbox.set_value(value);
     
    },


    Kind regards,
    Radoslav Georgiev
    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
2 posts, 0 answered