Skip Navigation

[Resolved] Populate an application CRED form with postdata

This support ticket is created 6 years, 3 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 14 replies, has 2 voices.

Last updated by a.e.a.m.S 6 years, 3 months ago.

Assisted by: Shane.

Author
Posts
#1142007
Schermafbeelding 2018-11-07 om 10.24.24.png

I have made a posttype with parent courses (Trainingen) and a posttype with child courses (Unieke trainingen), the child courses contains the different days, places (taxonomy), teachers (select) and some more unique fields.

I want to make an application form for the visitors that shows besides fields for name, address etc also some data from the childpost course like course name, date, place.

When clicking on a parent course, the visitor sees the global course info on the left of the page and some specific fields of the child courses in an accordeon on the right side.

I have placed a field in the unique course (DIRECT AANMELDEN) that links to a page where the CRED form (CRED Direct aanmelden) is shown.
Now i'm struggling how to show the unique course fields in the form.

#1142481

Shane
Supporter

Languages: English (English )

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

Hello,

You're saying that you want to show some of the parent fields on your Toolset Form for the child and make them auto populate?

Please let me know.

Thanks,
Shane

#1142901
Schermafbeelding 2018-11-08 om 08.52.44.png
Schermafbeelding 2018-11-08 om 08.53.01.png

Hi Shane,

I want some fields in the application form to be auto populated with the data from the childpost, the unique training, not from the parent post.

I have made a previous applicationform as shown in the attachment, this one pulls the name of the course from the parent field as shown in the bottom field "Betreft training:"
Now i want to make another form which should auto populate fields as date and place as shown in the attachment 08.53.01.png.
This is a visual editor field in the accordeon that shows the available unique courses from the main parent course.

If the visitor clicks on the link "DIRECT AANMELDEN" of the row 10 december, it should populate a field in the application form with the date "10 december 2018" the same for block of the day (ochtend/middag/avond) and city.

I hope you understand what i mean now...

#1143039

Shane
Supporter

Languages: English (English )

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

Hello,

I believe I understand what you mean but clicking on this DIRECT AANMELDEN will it take them to a form or will this be printed out on the same page that the user is on ?

Please let me know .

Thanks,
Shane

#1143617
Schermafbeelding 2018-11-09 om 08.41.58.png

Hi Shane,

It will lead them to a page where the form will be shown, see attachment. However, i also like the the idea what i did in the accordeon with the form for "Offerte incompany aanvragen" on that same page as shown on the image attachment in the message above but i think that would be harder to accomplish....

#1144000

Shane
Supporter

Languages: English (English )

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

Hello,

Would you mind providing me with admin access to the site so that I can setup a demo for you to look at ?

Thanks,
Shane

#1144001

Shane
Supporter

Languages: English (English )

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

private fields

#1145255

Shane
Supporter

Languages: English (English )

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

Hello,

Could you send me a link to the item you have in the screenshot so that I have a good reference to work with ?

Thanks,
Shane

#1145826

The link to the page is the same for each unique training, i have put the URL below in the "aanmelden" field in every "unieke training" message posttype. The link doesn't show yet for every unieke training because i placed the field afterwards, i have to resave each individual post in order for the field to show up.

I didn't know how to do it otherwise, if it can be done easier, please let me know....

Link to a unique training with links (DIRECT AANMELDEN) to the form in the accordeon : hidden link

Link to the form: hidden link

#1146018

Shane
Supporter

Languages: English (English )

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

Hello,

Just to confirm again.

Your user clicks the link and they will be taken to the Application form and the Training should be filled in ?

Which field should the date be added to ?

Also this needs to be in a post relationship to have everything organised correctly so I will be creating a One to many relationship between the Trainings and the Applications CPT.

Looking forward to hearing from you soon.

Thanks,
Shane

#1147105

Hi Shane,

If the user clicks on the link "DIRECT AANMELDEN" a new page will be opened where the user fills in the form, the data in the form should not alter the parent or child post, it's only purpose is to send data to the user, like a contact form.

The idea is as follows;
- The user clicks on the link "DIRECT AANMELDEN" which opens a form.
- Than chose which training to follow from a selectfield that is showing the posttitles of the parent postgroup "Trainingen"
- In the next selectfield the possibility to select a date, this would be filled from the "Datum training" field from the child postgroup "Unieke trainingen" this field shows the available dates for the child posttype "Unieke trainingen".
- Next field in the form will be the place, this is a taxonomy field related to the child posttype "Unieke trainingen"
- i also want to implement a filter, if the selectfield "Vol" in the child posttype "Unieke trainingen" = VOL it has to skip that training.
- The user fills in the remaining fields like name, address etc.
- The data will be send to the user and admin by email.

I need help how to connect everything together, i can make the form with the necessary fields, which kind of form do i have to make? a relationship form or message form?

Can you help me on the right track after i have made the form?

#1147248

Shane
Supporter

Languages: English (English )

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

Hello,

What I did to your sidebar thats listing Training Data location is to add their ID to the url in the form of a url parameter.

Now you should be able to add this to the value attribute of any field you want.

[types field='my-field' id="[wpv-search-term param='post_id']"]

This should get the value of that custom field based on the post that was click.

Please let me know if this helps.
Thanks,
Shane

#1147932

Hi Shane,

Thanks for the input, i see that the post-id value of the unieke training is shown as soon as you click on the "DIRECT AANMELDEN" link. How to proceed now? The link goes to the a blank page, the homepage pops up.

The link i placed in the field "aanmelden" in the posttype "Unieke trainingen" is the url: hidden link that is the place where i want to show the CRED form. The field "aanmelden" has no function at this moment?

Can you explain what i have to do to show a form and show fields form the "Unieke training" posttype?
It is still not clear to me....

#1148016

Shane
Supporter

Languages: English (English )

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

Hello,

I've explained this in the post above
https://toolset.com/forums/topic/populate-an-application-cred-form-with-postdata/#post-1147248

In your form you have this.

	<div class="form-group">
		<label>Betreft training</label>
		[cred_field field="post_title" value="[wpv-post-title]"]
	</div>

So you need to do the exact same for the fields that you want to get pre-populated with the values of the post that the user clicked on.

Using this shortcode.
[types field='my-field' id="[wpv-search-term param='post_id']"]

Now you will need to use the appropriate types field for the value to show up. So just add the shortcode as a value attribute as you did.

Thanks,
Shane

#1153819

Hi Shane, sorry for the late reaction.

I have tried to put the code in but it will not show me the values of the post the user clicked on.
Can you help me on the way by showing the CRED_field field='plaats-training' in the CRED form "CRED Direct aanmelden" the value "Oud-Beijerland" id a user clicks on the DIRECT AANMELDEN" link in the unique training: hidden link ?

If i see your working code i can copy it to the other fields.
You can use the login credentials i send you earlier.

Many thanks!