Announcement

Collapse
No announcement yet.

How do I add a hidden default value for custom field when register?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I add a hidden default value for custom field when register?

    I have a custom profile field called AlbumLevel, as Single Selection Menu with the options 2, 3, 9.

    I dont want user to edit this field, so I set the field to be
    Set Default = YES (either Including a First blank option or No first blank option)
    Field required = NO (so that registering member wont have to see/fill in this option)
    Field Editable by User = NO
    Private field = YES

    I want all new registered member will have this option to be 2, and they cannot see/change it. (only admin can change by editing the member's profile)

    However, this doesnt work. Value for this field is BLANK for new register member, wherether I set SET DEFAULT = YES, Including a First blank option or YES, but No first blank option

    I cannot add default value in MySQL either, it gives me error:

    SQL-query :
    ALTER TABLE `userfield` CHANGE `field34` `field34` MEDIUMTEXT DEFAULT '2' NOT NULL

    MySQL said:
    #1101 - BLOB column 'field34' can't have a default value




    How can I have the default value for this field?

    Thanks

  • #2
    The only method I know of to do this is to set the default value on the field itself (like you tried to do). If the field type won't take a default then try changing the field type. What kind of data is being stored in that field... would an INT type work for you? I know INT fields can have default values.

    Comment


    • #3
      Go to User Profile Field Manager
      Edit your field

      Fill in
      Default Value: You may specify a default value that is entered into this field at the time of registration.


      http://www.vbulletin.com/docs/html/p...dd_single_line
      Last edited by Barrikin; Thu 2 Sep '04, 4:00pm.

      Comment


      • #4
        Originally posted by Barrikin
        Go to User Profile Field Manager
        Edit your field

        Fill in
        Default Value: You may specify a default value that is entered into this field at the time of registration.


        http://www.vbulletin.com/docs/html/p...dd_single_line
        I think that only works if the field is editable on registration, otherwise the field remains blank.

        Comment


        • #5
          I played with it.

          You can give it a value only if its a text box. Doesn't matter if a user can edit it or not.

          Hope this helps.

          Comment


          • #6
            Originally posted by Barrikin
            I played with it.

            You can give it a value only if its a text box. Doesn't matter if a user can edit it or not.

            Hope this helps.
            well, but my field is a "single line selection"

            The only method I know of to do this is to set the default value on the field itself (like you tried to do). If the field type won't take a default then try changing the field type. What kind of data is being stored in that field... would an INT type work for you? I know INT fields can have default values.
            yes INT would work for me. However, if I upgrade vB (next version, for example), it will give me error when working with this field, unless I change fieldtype back to mediumtext before upgrading

            Originally posted by Jake Bunce
            I think that only works if the field is editable on registration, otherwise the field remains blank.
            will there be any way to work around it, in the next versions? Sometime "default value" is very important, you know

            Comment


            • #7
              Originally posted by mtha
              will there be any way to work around it, in the next versions? Sometime "default value" is very important, you know
              Not that I know of. Maybe.

              Comment


              • #8
                Originally posted by Jake Bunce
                Not that I know of. Maybe.
                so should that be added/fixed?

                should this post be reported as bug?


                When you say Default = YES, you means YES, I DO use default value. and if default value is not stored then ... it againsts what Default = Yes should be, isnt it

                Comment


                • #9
                  It's not really a bug, but more of a suggestion. I recommend you post this in the suggestions forum.

                  Comment

                  Loading...
                  Working...
                  X