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

Webforms strip the "<script>" tag in the last wizard step #9465

Open
SinergiaCRM opened this issue Jan 26, 2022 · 4 comments
Open

Webforms strip the "<script>" tag in the last wizard step #9465

SinergiaCRM opened this issue Jan 26, 2022 · 4 comments
Labels
Area: Campaigns Issues & PRs related to all things regarding campaigns Priority:Important Issues & PRs that are important; broken functions, errors - there are workarounds Type:Bug Bugs within the core SuiteCRM codebase

Comments

@SinergiaCRM
Copy link
Contributor

Tested in last version of SuiteCRM and https://demo.suiteondemand.com/

After creating a form, the javascript code is displayed in the HTML as normal text, this is due that the "<script>" tags dissapear before generating the code in the last step. See images bellow:
Selection_413

Scripts missing

Issue

Javascript code in WebForms aren't working cause the script HTML tags are missing

Expected Behavior

The script HTML tags should be present and javascript working

Actual Behavior

Javascript code appears as text in HTML

Possible Fix

Reverting some of last merged PRs

Steps to Reproduce

  1. Create a WebToLeadForm
  2. See that the javascript code appears in the site as text

Context

This shouldn't be happening.

Your Environment

SuiteCRM Version used: Version 7.12.2
Browser name and version: Chrome Versión 97.0.4692.71 (Build oficial) (64 bits)
Environment name and version: MySQL, PHP 7
Operating System and version: Ubuntu 18.04

@SinergiaCRM SinergiaCRM added Area: Campaigns Issues & PRs related to all things regarding campaigns Priority:Critical Issues & PRs that are critical; broken core functionality, fatal errors - there are no workarounds labels Jan 26, 2022
@Mac-Rae Mac-Rae added Priority:Important Issues & PRs that are important; broken functions, errors - there are workarounds and removed Priority:Critical Issues & PRs that are critical; broken core functionality, fatal errors - there are no workarounds labels Feb 1, 2022
@Mac-Rae
Copy link
Contributor

Mac-Rae commented Feb 1, 2022

Hi @SinergiaCRM,

There appears to be a simple enough workaround for these issues so I'd say marking as critical would not be required;

For those concerned inserting the following above and below the script section of code before submitting it to your website will fix it;

<script type='text/javascript'>
Exsisting script code in here
</script>

Can confirm however this is a bug in the latest verisions! 👍

@Mac-Rae Mac-Rae added the Type:Bug Bugs within the core SuiteCRM codebase label Feb 1, 2022
@SuiteBot
Copy link

This issue has been mentioned on SuiteCRM. There might be relevant details there:

https://community.suitecrm.com/t/problem-mit-angezeigtem-javascript-code-im-web-to-lead-formular/91359/6

@SuiteBot
Copy link

This issue has been mentioned on SuiteCRM. There might be relevant details there:

https://community.suitecrm.com/t/issue-with-displayed-javascript-code-in-web-to-lead-form/91360/3

@chris001
Copy link
Contributor

The offending line that strips the <script> tags is likely this one:

$html = $SugarTiny->cleanEncodedMCEHtml($bodyHTML);

Obviously it wants to strip the <script> tags in order to safely display in the browser without injecting active javascript onto the page.
A solution: generate 2 version: Non-cleaned, and Cleaned.

  1. Save the non-cleaned version,
  2. Display the raw text of the non-cleaned version, and
  3. Actively display the cleaned version on the page, giving the user a live demo of the generated form.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Campaigns Issues & PRs related to all things regarding campaigns Priority:Important Issues & PRs that are important; broken functions, errors - there are workarounds Type:Bug Bugs within the core SuiteCRM codebase
Projects
None yet
Development

No branches or pull requests

4 participants