More in this section

Forums / Developing with Sitefinity / Extending Forms

Extending Forms

2 posts, 1 answered
  1. Matthew
    Matthew avatar
    6 posts
    Registered:
    20 Jul 2011
    10 Nov 2011
    Link to this post
    Hello,

    I am writing to ask if something is possible. I would like to extend the forms functionality by adding a field, which I guess would be part of the form response, to all forms that would only show in the backend. Therefore it would not show on the front end and only backend users could edit this response field value. Is this something that is even possible? If so could you point me in the right direction to get started in implementing such a feature?

    Thank you
  2. Pavel Iliev
    Pavel Iliev avatar
    140 posts
    Registered:
    18 Jul 2016
    15 Nov 2011
    Link to this post
    Hi Matthew,

    Yes, it is possible. For a text box for example:
    Create a class that inherits from:

    Telerik.Sitefinity.Modules.Forms.Web.UI.Fields.FormTextBox

    Then override the Visible property and put this code:
    public override bool Visible
            {
                get
                {
                    if (this.IsBackend() || this.IsDesignMode())
                    {
                        return base.Visible;
                    }
                    else
                    {
                        return false;
                    }
                    
                }
                set
                {
                    base.Visible = value;
                }
            }


    Here IsBackend() and IsDesignMode() are extension methods in ControlExtensions. First will return true when a control is rendered in the backend of Sitefinity and the 2nd will return true if the control rendered while editing the form.

    All the best,
    Pavel Iliev
    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
    Answered
2 posts, 1 answered