Previous values now empty after updating

By: shaun haage | Asked: 11/15/2023
ForumsCategory: General questionsPrevious values now empty after updating
shaun haage asked 5 months ago

Hi, I have a form that contains 2 sections.

Part one is completed by our customers while part 2 has is hidden conditionally if users arent logged in (customers)

Alternatively, Part 2 is displayed if an admin updates the existing entry created by the customer, thereby completing our workflow.

What I have noticed is that when an entry is created the values for part one are populated, however when I as an authenticated user (Admin) edit the form, by previously added values are no longer present and display as blanks. How do I prevent this from happening?

Surely the default values shold be presesnt when the form is being updated and retain the existing data event if the form fields are hidden.

Kind Regards  

1 Answers
Rob LeVineRob LeVine answered 5 months ago

If the fields are not populated, it's almost definitely that you're not editing the entry, i.e., it's a new entry.  One thing that'll lead to this is if you don't have "Allow front-end editing of entries" turned on or if whatever link you're using to edit is not bringing up an editable version of the entry.

shaun haage replied 5 months ago

Hi Rob, "Allow front-end editing of entries" is enabled on the site and to edit from the grid view I created, I am using [editlink label=0 page_id=17024]&checklist=true where page id is the page where the original entry was submitted from. I am building this in elementor and have never really encountered these complications before. I also am concerned that when the edit page loads my get param="checklist" shortcode is not populating the default input value which I am conditionally using to ide/show sections if passed.

Rob LeVineRob LeVine replied 5 months ago

When the page opens, look at the HTML source. Do you see or do you see ?

Victor Font replied 5 months ago

Default values only populate when an entry is created. Default values will not work with edits. See this note from the knowledgebase about default values:

"Default values will be used when a new entry is created or when a field is conditionally shown.
Default values will not replace submitted values when you edit an entry, even if the submitted value is empty."

shaun haage replied 5 months ago

Sorry about the confusion, but I would have expected that when an entry was submitted. then updated the values submitted in the initial entry should remain in place.

As you can see, the initial entry saves the first and last name etc https://snipboard.io/2J5mbe.jpg correctly and this can be see from the view as illistrated. clicking on the edit link (https://www.justdieselperformance.com.au/warranty-application/?frm_action=edit&entry=4136&checklist=true) then provides me with the customised UI where the section containing the first and last name is now hidden however, the previously submitted values are still present in the form (https://snipboard.io/hficIS.jpg) completing the form, then resets those first and last name values and they are not empty / blank (https://snipboard.io/aVvQmS.jpg) when I revisit the edit link (https://www.justdieselperformance.com.au/warranty-application/?frm_action=edit&entry=4136&checklist=true)

Surely this is not expected, what am I doing wrong here?

Rob LeVineRob LeVine replied 5 months ago

It looks like my comment was corrupted because it contained HTML. So let's try it again.

When the page opens, look at the HTML source. Search for "frm_fields_container". Just below that you'll see a line that is a hidden field with the name "frm_action". Is its value "create" or "update"?

shaun haage replied 5 months ago

The form_action is "update" this is also evident as the CTA reads Update and not Submit (https://snipboard.io/ePEbT1.jpg) . If I now complete the "checklist portion" and click "update", when I return to re-edit the checklist, the initial application values (those completed as the initial entry) are now blank (https://snipboard.io/XsUqMo.jpg)

Victor Font replied 5 months ago

When I click your edit URL, the form action on the form says "create":

<input type="hidden" name="frm_action" value="create">

You are not editing the entry. You are adding a new entry.

Use PHPMyAdmin to confirm your data. You're doing something wrong.

Rob LeVineRob LeVine replied 5 months ago

I had the same experience @Victor Font . I am assuming that it's because you and I are not logged in. Either way, I think this has reached the end of my ability to help without being hired to debug and given user credentials to see it in action.

Victor Font replied 5 months ago

I agree with Rob 100%. You need a developer to put hands on the system. We're not going to solve anything through this thread.

shaun haage replied 5 months ago

Understood and thanks for all the assistance. I have found a work around for this and will share this shortly.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right