Skip Navigation

[Resolved] Guidance with relationship forms

This support ticket is created 5 years, 1 month 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
- 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)

This topic contains 12 replies, has 2 voices.

Last updated by Nigel 5 years, 1 month ago.

Assisted by: Nigel.

Author
Posts
#1456911
Screen Shot 2020-01-13 at 9.32.55 pm.png

I would appreciate some guidance with a project I am trying to build in toolset. I have two post types - repairs and retailers. I created a relationship of one retailer to many repairs.
I need an entry form to be able to choose a retailer and then scan multiple repair numbers, the end result I am looking for is the creation of multiple Repair records (one for each repair number related to the Retailer.

At present when I try to create a Front End page I keep seeing a JSON error…(see attached image)
Thanks, Roland

#1457415

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Roland

First, regarding the error, can I get your debug info to see what you have installed on your site?

hidden link

Second, regarding the question about a relationship form, I don't quite get what you are describing, if you could please clarify.

You have a retailer post type and a repairs post type, in a one-2-many parent-child relationship.

Forms publish (or edit) posts, one at a time.

So if you had a form to publish repair posts it would include a selector to specify the parent retailer the repair post should belong to (and you can set the form up so that this is pre-determined, if required).

I don't understand "scan multiple repair numbers" in this context. What are the repair numbers?

#1457765

Thanks Nigel, I'm feeling my way here... There are two forms, on stores a list of retailers who provide repair jobs to us. These jobs are delivered to our office and are (currently) manually checked off to show that we have them. I am trying to create a simpler way where we scan a barcode on each job and create a record in the Repairs form which relates to the retailer/store it came from. I would then want a form to display a list of jobs from a specific retailer/store that we have.
It would be great if we could record multiple jobs (say up to 10) to a single retailer in one go and have a back end script create the individual records for each job (that's what I was eluding to with the 'scan multiple jobs' comments... 🙂
Thanks very much

#1458007

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Roland

I keep reading and re-reading that description to understand what you are doing, but I think you are using terms such as forms which have a specific technical meaning to me and a more abstract meaning for you.

Toolset Forms, and forms available for WordPress more generally, don't work like what you might consider a form in an app, e.g. a to-do list app where for a given project you see a list of to-dos that belong to that project and you can check them off and make other changes in situ such as assigning a priority or whatever. What you are describing sounds a little like this to me.

A form in Toolset can publish or edit one post at a time. It can include a bunch of different fields of that post which get updated/published when submitting the form, but only a single post is updated/published by the form.

Now, you can use Views to display lists of posts, and the output of the View can be more than just fields of the posts being displayed, it could also include links to forms (or could display the form directly, in situ).

So, say you have a retailer (post) which already has some repair jobs (posts) assigned to it.

Let's say you have a View with search which lists retailers. You click the one you want and go to an individual retailer post.

In the template for retailer posts you insert another View, this time to show repair jobs belonging to this retailer.

There are a few ways I see forms involved here potentially.

The first is a form to add new repair jobs to this retailer. Typically the form would be shown on another page and you would link to it from here, but if it was a short form you may well include it in place. Such a form can only publish one repair job post at a time.

You might also include forms to edit existing repair jobs. So for each repair job listed by the View you could have a link to an edit form where all the fields of the repair job could be edited.

But you can also have variants of the edit forms. So if, from this list, you wanted a simple way to update a status field (a bit like checking off an item on a to-do list) you could create an edit form that contained just a submit button, display the actual form for each repair job in the list (i.e. just the button), and then use the API hooked in to that particular form to do one thing, such as update a status field.

Those are the kinds of ways you could use forms in such a scenario, and I can help with the implementation details if you have something specific you are trying to implement.

Lastly, back to that error message.

Thanks for the debug info. Your set-up doesn't seem to correspond to the one other case I'm aware of that generates the same error.

It probably arises from a conflict with another plugin or some code in your theme.

Could you please try disabling all non-Toolset plugins and switching theme to, say, twentynineteen.

Does the error disappear? If so it should be possible to determine what causes the error by a process of elimination.

Let me know what you find.

#1463143
Screen Shot 2020-01-17 at 2.49.04 pm.png
Screen Shot 2020-01-17 at 2.26.21 pm.png

Hi Nigel, sorry for the delayed response. I turned off all non Toolset Plug-ins (see attached) and am still getting the JSON error (also attached) when I try to create a new page.
cheers, Roland

#1463385

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

We have a few reports of something similar and are still trying to identify why.

Could I get access to your site? I want to take a copy to install locally, and also to check your logs to see if there are any errors or useful warning messages.

I will mark your next reply as private so that I can get log-in credentials from you—you may want to create a temporary admin user for me to use that you can later delete. And be sure to have a current backup of your site.

#1463803

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Screenshot 2020-01-17 at 12.33.34.png

Hi Roland

I did some basic debugging on your site and was unable to resolve the problem.

I saw 404 errors in your browser console when attempting to publish a page (screenshot).

I noticed you have some file permission modifications in your wp-config.php and I tried disabling those but it didn't help.

Nothing showing in your debug.log when I activated that.

So I've taken a duplicate of your site which I'll first install locally to see if I face the same problem.

I'll let you know when I've completed that.

#1463911

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

I installed the copy of the site locally and see no problems, it works as expected.

I'm not sure what to try next, so I'm escalating this so that my colleagues can take a closer look.

It is seemingly related to file permissions, if you know of any limitations on your server then please let me know and I'll pass on the info.

I'll keep you posted.

#1468463

Thanks Nigel, I have had a look at the database content and can see old data from a previous attempt at building some forms in Toolset. I think the best way to go will be to delete the database and do a fresh install so that we are starting with a clean slate.

#1468919

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

We have another client who was reporting the same error message and who, after contacting their host, was able to resolve the problem. We've sent them a follow-up to see if they can provide details of what the cause was, and when I get a reply I'll share that with you.

#1470637

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

One of the developers investigating this wanted to log in to your site to check some things, but it appears you revoked the credentials shared before.

Would you mind providing credentials again?

#1470877

Hi Nigel,

Sorry, I blew away the install and started with a clean one. I had previously built a series of Post Types, forms, etc and removed them to start building the Retailer and Repairs ones. However I didnt clean up the database and there was a lot of old posts and data left behind. Also lots of stuff from old plugins. I'll reconstruct the Retailers and Repairs and see if I can reproduce the error.
Thanks again for all your help with this, really appreciate it. Please close this one off for now and I will provide an update in a few days.
thanks, Roland

#1470883

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

OK, thanks for clarifying, I've passed that on to the developer.

Let me mark this as awaiting your feedback, and then you can update again in a few days if/when you see the issue or not.