Skip Navigation

[Resolved] Realtime update the selection

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

Supporter timezone: Asia/Kolkata (GMT+05:30)

Tagged: 

This topic contains 9 replies, has 2 voices.

Last updated by Minesh 5 years, 7 months ago.

Assisted by: Minesh.

Author
Posts
#1293023
Screenshot 2019-07-16 at 11.49.29 PM.png

Dear Sir/Madam,

Please refer to hidden link, I want to filter some of the districts when I change the locations, there is a relationship between locations and districts, I use the generic field in the form because of both the location and district will increase the number of posts. Below please find the code

		<label>區域 Location</label>
      [cred_generic_field type='select' field='gf-location'  class='form-control']
{
"required":0,
"default":[""],
"options":[[wpv-view name="json-location"]]
}
[/cred_generic_field]

	</div>
	<div class="form-group">
		<label>地區 District</label>
      [cred_generic_field type='select' field='gf-district'  class='form-control']
{
"required":0,
"default":[""],
"options":[[wpv-view name="json-district"]]
}
[/cred_generic_field]

I find there are Relationship Forms, what is that? Can it solve my need?

Best regards,

Kelvin.

#1293257

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

As I understand your request that you want to implement the dependent dropdowns where when you select any location from location dropdown it should update and display the associated related Districts.

There is no such feature available with Toolset forms using which you can implement the dependent dropdowns.

Regarding relationship forms - relationship forms are used to connect the posts that mean to make a connection between post types for which you created post type relationship. Again, this will not feature the requirement you want that when you select one post it will update another dropdown with the associated related post.

I suggest you should request this feature by filling out the following form:
=> https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

#1293301

Dear Minesh,

Thanks for your reply. May I know how I can use View to build the selection with a custom attribute and then feed into the generic field? Currently I use View to build the json format and feed into the generic field, here are the solution.

Code in View "json-location"

[wpv-item index=1]
{"value": "[wpv-post-slug]", "label": "[wpv-post-title]"}
[wpv-item index=other]
, {"value": "[wpv-post-slug]", "label": "[wpv-post-title]"}

Code in Form

      [cred_generic_field type='select' field='gf-location'  class='form-control']
{
"required":0,
"default":[""],
"options":[[wpv-view name="json-location"]]
}
[/cred_generic_field]

After putting the view output into the generic field, I finally get the option ( removing the tag generated by Form ) for the district like

<option value="central">Central</option>

How can I build the option including the location like

<option data-location="hk" value="central">Central</option>

where attribute data-location is the parent of the district Central

Can I do this using the relationship between custom post location and district?

Best regards,

Kelvin.

#1293331

Minesh
Supporter

Languages: English (English )

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

Basically - there is no option to build the dropdown the way you want. Because as you setup the dropdown using views which passes the JSON string which eventually generates the dropdown options.

This requires custom programming which is beyond the scope of our support policy. If you need custom programming for your project, please feel free to contact our certified partners.
=> https://toolset.com/contractors/

#1293345

Dear Minesh,

I understand there is no such option to build the dropdown the way I want, do you have any other sample how the Views can implement the use of the relationship between parent and child post? I need some to inspire me somethings.

Best regards,

Kelvin.

#1293433

Minesh
Supporter

Languages: English (English )

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

do you have any other sample how the Views can implement the use of the relationship between parent and child post?
=> Sorry - I do not get your point. you want to display the related (parent/child) posts using views?

#1293435

Dear Minesh,

Yes, any sample displaying the related (parent/child) posts using Views is fine.

Best regards,

Kelvin.

#1293451

Minesh
Supporter

Languages: English (English )

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

Have you check the following Doc:
=> https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/displaying-related-child-posts/

In addition to that, the only way you can have dependent dropdown is using parent and child post types. Please check our real estate reference site where you will find the views filter "State" and "City". Where it will update the "City" dropdown based on the "State" selection.
hidden link

You can create a free test site here:
=> https://discover-wp.com/site-types/bootstrap-estate-layouts/

#1293843

Dear Minesh,

Yes, I think it is what I want the View with dependent dropdown using parent and child post types but I want to do similar in Form, can I do that?

Best regards,

Kelvin

#1294335

Minesh
Supporter

Languages: English (English )

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

With forms, there is no such feature available.

That is why I suggest you submit a new feature request by filling out the following form:
=> https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/