Home › Forums › Front-end Issues › Hidden-by-conditional-logic get posted and create problems. › Reply To: Hidden-by-conditional-logic get posted and create problems.
Greetings John!
The main problem is that what you say here
“When a field is hidden by conditional logic that field is not submitted”
Doesn’t work as expected on my end, it get posted even on the first publish of the post, for example I have Choice 1 that open select field 1 and Choice 2 that open select field 2 and close select field 1, but if I pick an option from select field 1 and choose Choice 2 and enter value in select field 2 too both of the values get posted, and it creates a problem because I have the following fieldset in order to make a dynamic filter.
Car make : Acura, Aston etc..
Car Model Acura : Integra, MDX etc..
Car Model Aston : X70 etc..
When you choose Acura you have to choose an option from the “Car Model Acura” select field, and if you then change the value to Aston you have to choose from the other car model select, the problem comes on the front-end, because :
I use
if (get_field('car-model-acura')) {
echo the_field('car-model-acura');
}
if (get_field('car-model-aston')) {
echo the_field('car-model-aston');
}
But on the front end it shows:
“AcuraAston:IntegraX70”
Because I have values for both of the selects 🙁
And each edit is adding a value if there is another car-make or model choosen, the worst part is that the website won’t hold posts published from moderators or administrators it’s front-end posting, and users won’t clear their values, if they decide to change the year of the car for example.
One thing to mention is that I don’t have a reset value for the select fields, they start like :
Alpha Romeo
Acura
etc..
instead of
Choose a model
Alpha Romeo
Acura
etc..
And maybe if I add these values and use javascript to add them if the field has the acf-clhi class, and then in the backend define that this value shouldn’t display it would be an adequate solution?
Thanks for your time and descriptive answer! 🙂
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.