Skip Navigation

[Fermé] Product modify form – Dropdown list to select which product to modify

This support ticket is created Il y a 3 années et 11 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Ce sujet contient 1 réponse, a 2 voix.

Dernière mise à jour par Christian Cox Il y a 3 années et 11 mois.

Assisté par: Christian Cox.

Auteur
Publications
#1878517

I have a products modify form embedded in a page.
I am trying to put a dropdown field at the top of the page that already has all the products in the shop.
Selecting the product from the dropdown should automatically update the modify form on the page and allows me to modify the selected product.

#1878591

Hello, there's not really a built-in way to accomplish this in Forms. The recommended workflow is to place the Edit Post Form inside an unassigned Content Template, then create Edit Post Links and display them to the User. When the User clicks those links they will be redirected to a separate page containing the Edit Post Form.

If you want to include the Form on the same page instead and use a select field to choose a product to edit, it will require some custom programming. There is no AJAX or JavaScript API for Forms, so reloading the page is required when the User selects a product. When the page reloads, a URL parameter must be added to the page indicating the product ID the User wishes to modify, like this, where the selected product ID to edit is 12345:
https://yoursite.com/page-with-edit-form/?pid=12345

Then you could use Forms and Views shortcodes to pass that product ID from the URL parameter into the Form shortcode, so the Form is aware of the desired product ID to edit:

[cred_form form="Your Form Name or numeric ID" post="[wpv-search-term param='pid']"]

You would have to generate the Product Select field in the page using custom code, then use custom JavaScript to reload the page with the appropriate URL parameter when the User changes the select field.

https://toolset.com/documentation/programmer-reference/forms/cred-shortcodes/#cred_form
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-search-term

Le sujet ‘[Fermé] Product modify form – Dropdown list to select which product to modify’ est fermé à de nouvelles réponses.