I was experimenting with dropdown and checkboxes Dynamic fields, and it's easy to setup but it's very difficult to display the value of several entries selected (with Multiselect enabled). My first idea for your case was to set a Dynamic Field in your Student enrollment form, linked to the form with the Courses and the field with the course name, then set it to autocomplete and multiselect. Then, in every student enrollment entry you have a field with the courses that each one selected. The tricky part is to show it in the View and bringing up the details of the Courses form for every entry selected. Create a View for the Students, and then, let's say you display the Student name (field 233) and the Dynamic field with the courses (field 234):<div>Student: [233]</div>
<div>Courses: [234]</div>There you have this output for every student:Student: John Smith
Courses: Course1Name, Course3Name, Course7Name (..etc..)But we need the id of every Course entry, just to pull the Name, details, etc. from every course selected. We can obtain the ids like this:<div>Student: [233]</div>
<div>Courses: [234 show=id]</div> Or show them as a list with this: <div>Student: [233]</div>
<div>Courses:</div>
<div>[234 show=id sep="</div><div>"]</div> The output for the last will be:
Student: John Smith Courses:
174
177
181
For it is showing the id of every selected course entry.
Then I was stuck there - Because I cannot wrap those numbers inside this shortcode to be repeated in each iteration:[display-frm-data id=course-view courseid=174]
[display-frm-data id=course-view courseid=177]
[display-frm-data id=course-view courseid=181]That way we would have a display with the details we like from every selected course, below the correspondent student. If someone here knows how to use those number from the display of the field, it would be very useful for your needs.If it was my project, despite I like the above incomplete solution more, I would take a workaround: I would create a new form called something like Course Selection, with two fields minimum: a text field called "Student ID", with default value [get param=student-id] and one Dynamic field linked to the Courses form / Course name field, with the label "Select one course".Then, in the Student form, insert the Course Selection form or a Modal form to be opened when a link is pressed. Now we are creating an entry everytime the link is pressed and one course selected, and that entry will be linked to the Student via the field "Student ID". You can now list all the students with their chosen courses or to insert, wherever you want, a View that lists every chosen course by one Student (and any detail from each course).
There is a more sophisticated way that involves Javascript and PHP snippets at the same time. I did it once, if you really need it I could help you, and maybe it's possible to use the first option combining both. If you need more insight/details about this, tell me and we can be in touch to develop it.
Sorry for the layout of my answer but this forum system messes up the line-breaks.
Hi Julius,
Thank you for the very detailed response. I think it's actually a bit more complicated that what I need. I just need to show one entry (from the courses form) filtered by the dynamic field that the student selects in the enrollment form (the name of the course).
Here's a simpler breakdown:
Form A: Courses Form
-Name of course
-Fields for course details (schedule, etc.)
Form B: Student Enrollment Form
- Various fields for student info
- Dynamic dropdown of courses pulling from Name of Course field in Form A
Form C: Enrollment Agreement
- Auto-populate student info from Form B
- Show course details (for only one course) from Form A based on the selection in the dynamic field in Form B.
I feel like this should be relatively easy, but I keep getting stuck.
This is exactly what I am trying to achieve, but for a doctor/ patient consent form system.
Did you manage to work out how?
Let me se if I understand your layout. There's no direct link between Student Enrollment and and Courses other than the entry id of the dynamic record. The name of the course is irrelevant when using dynamic fields. Dynamic fields link the Student form to the courses form through the course record entry id. The idea is that with dynamic fields, any field in the linked lookup record can be displayed on the Student Form.
For this to work with a view, you need to create two views and nest the second into the first. You don't need a view for Courses because every datapoint is included in the look up record. To access any of the data points, do you look up fields short code with the "show" parameter.
The enrollment agreement can be created on the fly by transferring the content you need from the student enrollment through the confirmation redirect and a query string. You can also use the Formidable API add-on to create the enrollment agreement form. Make sure you transfer the value of the dynamic field from the Student enrollment form to a similar dynamic field in the enrollment agreement.
This example is from the header view of the any Formidable Masterminds Codex V2 entry:
<!-- wp:heading -->
<h2 class="wp-block-heading">[codexv2_plugin_name show=frm_codex_lu_addon_plugin_name]</h2>
<-- /wp:heading -->
[display-frm-data id=8140 header=[codexv2_plugin_name show="id"]]
What this code does is display a generic header in a WordPress block. Next it calls the nested view, which in your case is the enrollment agreement. The codexv2_plugin_name is a dynamic field. I use the show="id" parameter to pass the lookup record's entry ID to the nested view where it is used as a filter.
That's the basics for how a nested view can work. I really can't tell you how to make this work with your design because i don't know your data or form structure. For further details about nested views, please see this Formidable KnowledgeBase article. https://formidableforms.com/knowledgebase/advanced-view-concepts/
The Student Enrollment record, BTW, is your equivalent to my header view.
Please login or Register to submit your answer