Bug: Adding a custom control to a form - Bugs & Issues - Bugs & Issues - Progress Community
 Bugs & Issues

Bug: Adding a custom control to a form

  • Bug: Adding a custom control to a form
  • Can this be registered as a bug in the system, and rectified for the final release.

    I and others have attempted to create a custom control and add it to a form, but are getting errors.

    This thread documents what we have tried so far:

    http://www.sitefinity.com/devnet/forums/sitefinity-4-x/general-discussions/adding-custom-controls-to-form-builder.aspx
  • Hi Matt,

    There is not a bug to the Forms. The problem is that the data you pass. Can you post the code you have implemented and more expecially the javascript where you pass the date value?

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • This is the complete javascript file.  I can send you the project for my control if you provide an ftp site or email address I can post it to.

    Type.registerNamespace("ServerControl1");
     
    ServerControl1.FieldControlCustom = function (element)
     
        this._picker = null;
        ServerControl1.FieldControlCustom.initializeBase(this, [element]);
     
     
     
     
    ServerControl1.FieldControlCustom.prototype =
        /* --------------------------------- set up and tear down --------------------------------- */
        initialize: function ()
            ServerControl1.FieldControlCustom.callBaseMethod(this, 'initialize');
        ,
        dispose: function ()
            ServerControl1.FieldControlCustom.callBaseMethod(this, 'dispose');
        ,
     
     
        get_picker: function ()
            return this._picker;
        ,
        set_picker: function (value)
            this._picker = value;
        ,
     
     
        /* --------------------------------- public methods ---------------------------------- */
     
     
        reset: function ()
            this.set_value(null);
            ServerControl1.FieldControlCustom.callBaseMethod(this, "reset");
        ,
     
        // Gets the value of the field control.
        get_value: function ()
     
     
            if (this.get_displayMode() == ServerControl1.FieldControlCustom.FieldDisplayMode.Write)
                if (val == '')
     
                
            
            returnval;
        ,
     
        // Sets the value of the text field control depending on DisplayMode.
        set_value: function (value)
            if (this._hideIfValue != null && this._hideIfValue == value)
                if (this.get_displayMode() == ServerControl1.FieldControlCustom.Write)
     
                
                else
     
                
            
            else
                if (this.get_displayMode() == ServerControl1.FieldControlCustom.Write)
     
                
                else
     
                
            
            this._value = value;
            this.raisePropertyChanged("value");
            this._valueChangedHandler();
        ,
     
        // Returns true if the value of the field is changed
        isChanged: function ()
            if (this._value == null) this._value = "";
            var notChanged = (this._value == this.get_value());
            if (notChanged)
                return false;
            
            else
                return true;
            
        
     
     
        /* --------------------------------- event handlers ---------------------------------- */
     
        /* --------------------------------- private methods --------------------------------- */
     
        /* --------------------------------- properties -------------------------------------- */
     
    ServerControl1.FieldControlCustom.registerClass('ServerControl1.FieldControlCustom', Telerik.Sitefinity.Web.UI.Fields.FieldControl);
  • Hello Matt,

    There are missing parts int he javascript which you have not completed. Just a quick sample would be this part

    if (this.get_displayMode() == ServerControl1.FieldControlCustom.Write)
                                  
                
                else
     
                


    As you can see nothing happens if this condition is true or false. Both the conditions are empty.

    I will create a sample control again and post the updated information in the original post.

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • Thanks Ivan.