CalderaWP / Caldera-Forms

Drag and drop, responsive WordPress form builder.
https://CalderaForms.com
GNU General Public License v2.0
187 stars 163 forks source link

Magic tags in HTML Field Breaks Condition binded to the html field #3274

Open adamjayb opened 5 years ago

adamjayb commented 5 years ago

Do You Need Immediate Help?

No.

Is This A Feature Request?

No.

What Version Of Caldera Forms, WordPress and PHP Are You Using?

Caldera Forms Version: 1.8.5 PHP Version: 7.0.33

Does Your Issue Persist When You Disable All Other Plugins and Switch To The Default Theme?

Yes.

What Is The Unexpected Behaviour?

I created two HTML fields and set them to Show only when their respective condition lines are true. This was supposed to only Show one of the two HTML fields at a time depending on if the condition was true.

What happens instead is that the HTML fields alternate and Show only once when being toggled between and then disappear until the page is reloaded.

What PHP Errors Have You Logged While Reproducing This Bug?

None.

What JavaScript Errors Have You Seen While Reproducing This Bug?

None.

New0 commented 5 years ago

Hello @adamjayb , I tested adding two html fields in a form and a toggle switch field with two options. Then added two conditions, the first shows he first html field if the first toggle option is active, the second shows the second html field if the second toggle option is active. This worked for me ( I attach the form for context ->
contact-export.zip )

Could you share your form or more details that leads to the issue ?

adamjayb commented 5 years ago

Hi @New0, did you try toggling back and forth after they first appear to see if they reappear once the condition is true again? The HTML fields will appear the first time the condition is true, as it's supposed to, but once it is switched via an option and becomes untrue to hide the field and a user decides to change their mind and switch the option again to make the HTML Show condition true again, the HTML field will not reappear.

New0 commented 5 years ago

Hi @adamjayb , yes the fields are reappearing on my form, could you share a zipped form export that shows the issue ?

adamjayb commented 5 years ago

Hey @New0, I have attached the HTML Breaker. Also, I failed to mention that the HTML must include a Field Slug Magic Tag in order to break its Show/Hide conditions -- sorry about that.

html-breaker-export.zip

New0 commented 5 years ago

Hello @adamjayb , thanks for the detail, it's an important one. I could reproduce the behavior and renamed the issue.

Aikobot commented 3 years ago

As a possible workaround for some, I have found that this bug does not affect the Text field type. So it is possible to fill the Default property input of a Text type field with content, including magic tags, add a CSS class in the Custom Class property field and then use CSS to prevent users from editing the content (so the Text field behaves like an HTML field) like so: .read_only { pointer-events: none; }