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]
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
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.
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