Skip Navigation

[Resolved] Using CRED form to populate multiple fields after selecting user from View

This support ticket is created 4 years, 5 months 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Shane 4 years, 5 months ago.

Assisted by: Shane.

Author
Posts
#1777381

We have created a View with a Select User Name, then using a form to populate a custom post (Offers) with data based on that user.

I can get the User ID to update, but not the other fields required

What is the link to your site?

lowtherpavilion.co.uk

It's the fields from "Offer Title" downwards that I am trying to auto populate with additional data from the user after selecting the user record.

View:

[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<wpv-loop>
[wpv-item index=1]{"value":"[wpv-user field="ID"]","label":"[wpv-user field="display_name"]"}
[wpv-item index=other],{"value":"[wpv-user field="ID"]","label":"[wpv-user field="display_name"]"}

</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No users found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]

Form:

[credform]

[cred_generic_field field="wpcf-user-id" type="select" class="" urlparam=""]
{
"required":0,
"validate_format":0,
"persist":1,
"default":[],
"options":[ [wpv-view name="select-user"]]
}
[/cred_generic_field]

<div class="form-group" style="display:none;">
<label>Offers</label>
[cred_field field='@opportunity-offer.parent' class='form-control' output='bootstrap' select_text='--- not set ---' value='[wpv-post-id]']
</div>

<div class="form-group" >
<label>Offer Title</label>
[cred_field field='post_title' class='form-control' output='bootstrap' value='[wpv-selected-user] / [wpv-post-title] / [types field="show-date-and-time"]']
</div>

<div class="form-group" >
<label>First Name</label>
[cred_field field='first-name-offers' force_type='field' class='form-control' output='bootstrap' value='[wpv-current-user info="firstname"]']
</div>
<div class="form-group" >
<label>Last Name</label>
[cred_field field='last-name-offers' force_type='field' class='form-control' output='bootstrap' value='[wpv-current-user info="lastname"]']
</div>
<div class="form-group" >
<label>Opportunity ID</label>
[cred_field field='opportunity-id-offer' force_type='field' class='form-control' output='bootstrap' value='[wpv-post-id]']
</div>
<div class="form-group" >
<label>Offer Status</label>
[cred_field field='offer-status' force_type='field' class='form-control' output='bootstrap' value='Pending']
</div>
[cred_field field='form_submit' output='bootstrap' value='Offer to Volunteer' class='btn btn-primary btn-lg']
[/credform]

#1777781

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Ian,

Thank you for getting in touch.

Can you provide a bit of clarity here for me? Is it that you want to populate the form fields with the values of the user that is currently logged in ?

Please let me know and we can take it from there.

Thanks,
Shane

#1778353

Hi Shane

The aim is to be able to select the user from the JSON list (which is working) and then populate additional fields based on the selected user.

#1778857

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Ian,

Thank you for the clarity.

Unfortunately no this isn't possible to do, you will need to use custom code in order to get the values from the selected option in order to populate the other fields on the form.

Thanks,
Shane