Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.1] script tag data-rules-json not rendered using vuejs #1233

Open
jeroenlammerts opened this issue Apr 24, 2024 · 1 comment
Open

[5.1] script tag data-rules-json not rendered using vuejs #1233

jeroenlammerts opened this issue Apr 24, 2024 · 1 comment
Assignees
Labels
freeform5 Affects Freeform 5.x issue Something isn't working correctly

Comments

@jeroenlammerts
Copy link

Describe the bug or issue you're experiencing
Having conditional logic applied to a form, a script tag is rendered before the form tag closes.

 $event->addChunk(
    '<script type="application/json" data-rules-json>'.$serialized.'</script>'
 );

When using vuejs 3 this causes the following warning, so the script tag is not rendered.
[Vue warn]: Template compilation error: Tags with side effect (<script> and <style>) are ignored in client component templates.

Freeform 4 is working in a different way using data-ff-rule attribute to fields.

Steps to reproduce

  1. Build a site with vuejs 3 having a <div id="app"> around the whole site.
  2. Add conditional logic to a form
  3. This is causing the error, the script tag is ignored.

Expected behavior
Maybe the plugin should respect the following setting and also insert the data-rules-json to that location.

Freeform Script Insertion Location
The location of where you want Freeform to insert its scripts for form and field functionality.

Craft & Plugin Info (please complete the following information):

  • Craft Version: Craft Pro 4.8.0
  • Freeform Version: 5.1.14
  • Freeform Edition: Pro
  • Fresh Install or Upgrade: Fresh install
@jeroenlammerts jeroenlammerts added the issue Something isn't working correctly label Apr 24, 2024
@kjmartens
Copy link
Contributor

Thanks for your feedback @jeroenlammerts.

I will get a developer to check into this and respond to you shortly. 🙂

@kjmartens kjmartens added the freeform5 Affects Freeform 5.x label Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
freeform5 Affects Freeform 5.x issue Something isn't working correctly
Development

No branches or pull requests

4 participants