Skip Navigation

[Resuelto] How can a relationship between types be required?

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

Problem:
How to make adding related posts required when editing a post in the backend?

Solution:
It is not currently possible.

You can add your voice to request such a feature here: https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

This support ticket is created hace 5 años, 3 meses. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

Este tema contiene 4 respuestas, tiene 2 mensajes.

Última actualización por Francisco Ramón Molina Busquiel hace 5 años, 3 meses.

Asistido por: Nigel.

Autor
Mensajes
#1307795

Hi,

A field can be set as required, but a relationship between types how can it be set as required?
For example, I have 1 relationship between the "Manufacturers" type and the "Printers" type, when I add a printer I would like it to be mandatory to indicate a manufacturer.

Thanks for your help.

Regards,
Francisco R.

#1307913

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

Screenshot 2019-08-02 at 14.48.07.png

Hi Francisco

This is another thing that would make a reasonable feature request (there is no such option currently available), but in this case you could add a snippet of JavaScript to add the "required" attribute to the select input so that the built-in browser validation would indicate that the field was required (screenshot).

I'm assuming you are using a front-end form to add the posts.

In that case you also have the option of performing custom server-side validation, using the cred_form_validate filter: https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_validate

#1308133

Hi Nigel,

No, I am using the dashboard.
It's a website for other people and I don't want them to make mistakes and this is a hole. 🙁
It is a pity that you have not taken it into account.
It is something you should have yes or yes.

Thanks for your help.
Regards,
Francisco R.

#1308191

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

In this case there is not much that can be done as a workaround.

There is no equivalent validation filter for the back-end, and it's not possible to add a required attribute to the select dropdown for the parent because, until you press the button to add or connect a related post, there is no dropdown.

I see that you have already submitted the request, and I'll mention it to the developers at our daily meeting to encourage them to implement it soon.

#1308207

My issue is resolved now. Thank you!