Skip Navigation

[Resolved] suppress error for single field on post form

This support ticket is created 4 years, 8 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
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)

This topic contains 8 replies, has 2 voices.

Last updated by MattI4840 4 years, 8 months ago.

Assisted by: Christian Cox.

Author
Posts
#1311733

Tell us what you are trying to do?

I have a post form with a several relationship based fields, one of the fields isn't mandatory and I would like to set it as such, but I don't see a way to do so in the GUI when adding the field and it throws an error when submitting the form when the form is submitted, even though it does save the data.

#1311741

Can you show me the field's settings? If the field is attached to the relationship, you should go to Toolset > Relationships and edit the relationship. At the bottom of the screen you can see "Edit Fields". That will take you to a field editor screen. Is the field marked as required here? Please take a screenshot showing the settings for me.

#1311751
Edit-Relationship.JPG

Christian,

I'm a little confused here, on the 'Edit Relationship' screen there is no 'Edit Fields' link, but even if there were the form field on the post form is connecting two custom post types, I don't see any way to set that as required as it's not a field it's two cpts.

This is the code for the field on the post form, if that helps. I also tried to


<div class="form-group">
		<label>Select Contract/Month</label>
  [cred_field field='@deliverable-parcel.parent' class='form-control' output='bootstrap' select_text='--- not set ---']
    </div>

Thanks,
Matt

#1311787

Okay by "relationship-based fields" I thought you meant you had created a many-to-many relationship with an intermediary post type. If so, then you would have the ability to apply fields to the relationship intermediary, and the "Edit Fields" button would appear in the relationship editor you showed. But I can see now that's not what you have. Can you explain what kind of Form this is? Does it create Parcels? Does it edit a Deliverable? I can't see based on the informaiton I have. And what is the intention here - are you trying to update the Deliverable's custom field value, or are you trying to include the Deliverable's custom field value in the Parcel post's custom fields somehow, or are you just trying to display information from a Deliverable in the Form?

#1311821

Yes this form creates a parcel, in this app parcels are outgoing deliveries. Parcels have either one or two parents, the purchase order they were bought under which is mandatory, and the deliverable which is a monthly breakdown of the purchase contract the client submitted. However, at times a single purchase order will come in from a client rather than a multi-month purchase contract. For this reason the deliverable drop down may or may not be used, which is why I need the ability to leave it blank and not receive an error.

I understand the architecture behind this app is complicated/convoluted but my client continues to add new functionality (scope creep is fun) which keeps me constantly on my toes.

Just going over this in my head again, would creating a 'catch all' deliverable called "None" or "N/A" and making that the default value for the drop down be a viable option, or is that just going to be a work around that could cause more headaches down the line?

#1311825

It's not required to select a parent post in a new child post Form, even if two parent post types exist, so I'm not sure what the problem could be.
- Can you share the error you mentioned when the Form is submitted?
- Is there any custom PHP code in use here, like a cred validation script?
- Does the error occur with only Toolset plugins active and a default theme active?

#1311841

Ah there it is, the issue is in the custom code that is executing when the form is submitting without that field being set. It is referenced in the function that fires, so if it's not set it's throwing an error. I'll remedy that with and let you know if the problem persists in the morning. Thank you Christian for walking through that with me.

#1312383

Okay great, let me know how it goes.

#1314527

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.