Skip Navigation

[Resolved] Change field type on form (from single to select)

This thread is resolved. Here is a description of the problem and solution.

Problem:
Change field type on form (from single to select)

Solution:
Types custom fields have restrictions, you can not convert all field types to your desired field type, in your case, its not possible to convert the text field to select type as Types natively do not support it.

You can find the proposed solution in this case with the following reply:
https://toolset.com/forums/topic/change-field-type-on-form-from-single-to-select/#post-1385559

Relevant Documentation:
=> https://toolset.com/documentation/user-guides/inserting-generic-fields-into-forms/

This support ticket is created 5 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Author
Posts
#1385529

Tell us what you are trying to do? Make a "add new" form where one of the fields is a dropdown of a few options for the user to select HOWEVER that field was setup as a single line field (I cannot change that field type for some other reasons).

Basically this is what forms is generating (a single line field): [cred_field field='replytype' force_type='field' class='form-control' output='bootstrap']

I want it to be something like this (a select field)... I know this is not the correct html for a toolset field 🙂

[cred_field field='replytype' force_type='select' class='form-control' output='bootstrap']
<option value="">Select below</option>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
[/cred_field]

#1385559

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Basically, Types custom fields have restrictions, you can not convert all field types to your desired field type, in your case, its not possible to convert the text field to select type as Types natively do not support it.

You have two ways, if you do not have any content related to that field, you should simply delete that field and add a new select field from your custom field group. You can delete the custom field permanently from:
=> Toolset => Custom Fields => Post Field control

If you do not want to change your single line custom field type but still want to display as select field with your form, you can use the Toolset Generic field.

For example:

[cred-generic-field field="wpcf-replytype" type="select" class="" urlparam=""]
    {
        "required":1,
        "validate_format":0,
        "persist":1,
        "default":[""],
        "options":[
            {"value":"0","label":"Select Option"},                
            {"value":"111","label":"AAA"},
            {"value":"222","label":"BBB"}
        ]
    }
[/cred-generic-field]

More info:
=> https://toolset.com/documentation/user-guides/inserting-generic-fields-into-forms/

#1385919

My issue is resolved now. Thank you!