Skip Navigation

[Resolved] Default value for a generic select cred field

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.

This topic contains 3 replies, has 2 voices.

Last updated by romanB-3 2 years, 10 months ago.

Assigned support staff: Minesh.

Author
Posts
#570899

Hello,
I have this select cred field

      [cred_generic_field field='responsable-projet' type='select' class='' urlparam='']
      {
      "required":1,
      "validate_format":0,
      "default":[],
      "options":[json-users-list]
      }
      [/cred_generic_field]

populated with a json list of users.
In my "edit" cred form for the CPT, I need to pre-fill the select with the value stored in [types field='responsable-projet'][/types].
How can I do this ?
Thnak you.

#570920

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

What if you try to use following code and assign the types shortcode to your default value:

[cred_generic_field field='responsable-projet' type='select' class='' urlparam='']
{
"required":1,
"validate_format":0,
"default":[[types field='responsable-projet'][/types]],
"options":[json-users-list]
}
[/cred_generic_field]

Does this help?

#570927

Hello and thank you,
I already tried this with no effect. I was thinking it was because the JS is executed after the the default is set. Is this possible ?
Thank you.

#570935

Minesh
Supporter

Languages: English (English )

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

Which JS you mean is executed after?

Could you please share problem URL?

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.