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

Forums / Developing with Sitefinity / Can I change column names for form fields?

Can I change column names for form fields?

10 posts, 0 answered
  1. Ed
    Ed avatar
    20 posts
    Registered:
    26 Mar 2013
    23 Feb 2015
    Link to this post
    I would like to be able to change the column names in the table that corresponds to forms I create in Sitefinity 7.3. For example, I have an input with Label consisting of "First Name". I see a read-only setting for "Advanced: Name for developers", which is set by default to FormTextBox. I'm not really sure what that is even for because the actual column in the database where this data is going is called "form_text_box". I need to change that "form_text_box" column to something like "First_Name". Can this be done?
  2. Ed
    Ed avatar
    20 posts
    Registered:
    26 Mar 2013
    26 Feb 2015
    Link to this post

    I came across this today, regarding renaming the tables:

    http://www.sitefinitysteve.com/blog/code/2012/03/24/sitefinity-how-to-list#Rename%20a%20Forms%20Database%20Table

     I have no idea if it's safe or not, particularly because I don't know what the dependencies are or how to find out what they are. Also, I'd still need to rename columns as well in order to do what I need to do. 

     Anyone have any ideas?

  3. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    26 Feb 2015
    Link to this post

    My snippit is to change the DB TABLE name, not the advanced name for developers...you might have to talk to support to get a script to do that.  I'm sure it's doable...

     This is one of my main SF Forms gripes, the naming sucks.  Way way back, those autogenerated (totally crappy) dev names used to be what showed up on the EXPORTS, not sure if that's still the case, but maybe.

     What needs to happen is a Regex needs to run as the user types, like on creating a page, and the Advanced name "Suggestion\Default" needs to be based on the Name\Title, not the ID or Control type...it's just insane this hasn't been addressed yet.  I mean there's always something to address, but this is (aside from no permissions) a HUGE problem with forms thats inconsistant with the rest of the CMS.

     I just tell forms editors to always open that up and remember to set the "developer name"...it's insanity.  Heck even I forget to do it sometimes...like 10 widgets on a page, maybe I forget on 1....and it's set for life.

  4. Ed
    Ed avatar
    20 posts
    Registered:
    26 Mar 2013
    26 Feb 2015 in reply to Steve
    Link to this post

    So is there no way to change the column names?

     The reason I ask is because we have a script that runs periodically that hits a database, with a given table, and with given fields, and pulls data from it. We'd like to just set up a form, with corresponding table definition, with the same names so we don't have to ask anyone to change anything about the script, with the exception of the access info and db name. Is this in any way possible? Or do we simply need to have someone re-write that script to reflect whatever those table column names are?

  5. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    26 Feb 2015 in reply to Ed
    Link to this post
    In the UI no, like I said, contact support and ask them if they have a dbscript or can make one...I'm sure it's possible somehow
  6. Ed
    Ed avatar
    20 posts
    Registered:
    26 Mar 2013
    26 Feb 2015
    Link to this post
    Ok, thanks, will do!
  7. Ivan Eftimov
    Ivan Eftimov avatar
    23 posts
    Registered:
    20 Jul 2016
    03 Mar 2015
    Link to this post
    Hello Edward,

    You can control the database column names through the Name for developers when you add the field for the first time in the form. After you publish the form which contains the newly added field, you cannot change it anymore.
    The same applies for the form Name for developers, which affects the table name which is created in the database.
    I hope this helps you achieve your solution.

    Regards,
    Ivan Eftimov
    Telerik
     
    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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  8. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    03 Mar 2015 in reply to Ivan Eftimov
    Link to this post

    @Ivan

      The problem isn't that he doesn't know about that, it's that it's already set the once and borked his DB table with pointless generic names like form_text_box

  9. Eric
    Eric avatar
    1 posts
    Registered:
    13 Aug 2014
    02 Jun
    Link to this post
    Tacking on to the end of this post since it's related.... I also needed to rename some columns on a Sitefinity 7.3 instance - when I was editing my form fields, I found the MetaField > FieldName property and tried changing the field name to something more meaningful there, which seemed to work (it changed the "Name for Developers"); however, the existing responses form appear to be missing - is there any way to get those back?  In the underlying data, it appears renaming in this way just dropped the database columns from the related form's table and never created the new columns, which is now perhaps causing an error preventing display of form responses.
  10. Svetoslav Manchev
    Svetoslav Manchev avatar
    735 posts
    Registered:
    27 Sep 2016
    07 Jun
    Link to this post
    Hello Eric,

    This scenario is not supported but you can try to add a field in the Form, which to be used from now on, changing the name for developers as per your needs, before publish the form.
    In addition on a backup project you can try to copy the old values in that new column manually, check it this works for you and remove that old field in question.

    Another option is to recreate the entire Form, which is the recommended approach, changing the name for developers in advance as per your needs. You can also use the API, if needed to transfer the available responses: http://docs.sitefinity.com/for-developers-form-responses to the new Form.

    Regards,
    Svetoslav Manchev
    Telerik
     
    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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
10 posts, 0 answered