I have a view where two forms.
/listado-bonos-administrador/
I would like to combine the form of the 'comprobante' column and 'comercios' column in one, but 'comercios' is a child view. How can I do it?
EDIT:
Here, I have two forms in same column but i need that are unique form
?page_id=10048
Thanks
Hello and thank you for contacting the Toolset support.
We can't combine both forms into one single form because the first one is a Post form and the second one is a Relationship form meant for a many-to-many relationship. If it were a One-to-many relationship, we can put the relationship into the first form and remove the second one.
It is possible to customize the first form by including a generic field that can be used for the relationship part and use some custom code to save the relationship once the form is submitted. But this will need multiple custom codes. It may need some Javascript code to make the field as a select2 field, some PHP code to play as the backend for this select2, then some PHP code to save the relationship when the form is submitted. This last part can use the relationship API such as toolset_connect_posts
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_connect_posts
It's also possible to come up with some custom Javascript code that can submit one of the forms when the second one is submitted.
I hope this answers your question. Let me know if you have any further questions.
Hi Jamal,
Thanks for you reply. form-comercios 1 to many
1 'comercio' can have multiple bonuses
but 1 'bono' can only have one 'comercio' assigned
but it won't let me change it. (see picture)
If it could be 1 to many, could you put it in the same form? Could you help me?
Yes, if its 1-to-many you can put it in the form.
Toolset won't let you change the type of the relationship, you will need to remove and recreate it again. But take a database backup, because the current forms, relationships may break.
Thanks Jamal,
I have already changed the relationship and created another form.
You can see it in:
view: listado bonos administrador prueba
relationship: Validacion-comercios-bonos
form: validacion-bonos-comercios
Now, What do have I do?
I cound not a form named 'validacion-bonos-comercios', so, I assume that you were talking about the form 'Adjunto bonos' as this is the one that was created today.
As you can see in the screenshot, there are two fields for the relationships that you have for the Bonos post type. hidden link
You can add any of those relationships to the form.
I wanted to test it, but the view and the form are not used anywhere. So, I'll let you do this and if you find any troubles, let me know where I can see this new form in the frontend.
Thanks Jamal.
It's fine. You can see here /prueba/.
I have other question with this form, is it posible to change status of 'bono' when i submit this form?
Thanks!
I don't see any form in the page /prueba/ so, I followed it up to check its view "Listado bonos administrador prueba" and it seems that the form is inside a conditional on a custom field "comprobante".
Did it work for you? If no, please add a post or change its custom field so we can see the form and let me test.
Regarding your last question, do you want to change the post status when the form is submitted or when certain criteria are met? If the first case, you can configure the status to save in the form. Check this screenshot hidden link
Hi Jamal,
The form is seen in the column 'validacion bonos'
About the states, in this case the state is a 'bonos' taxioma. So I want the form to go from 'no usado' to 'usado' when the form is submitted.
The form seems to work well. Check this screenshot before hidden link
And this one after hidden link
Regarding the status, I don't see "no usado" or "usado" in the list of available posts hidden link
However, for support rules, we are able to handle only one issue at the time. This helps us to bring you a better service and also helps other users to find all the information here exposed. For that reason I have to kindly ask you to open a new thread about it. Provide more details about the states ("no usado" or "usado"). Are these custom statuses added with custom code, or are these values for a custom field?