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

Conditional Logic no longer working after upgrade to forms 8.3.0 #273

Closed
yorky002 opened this issue Jan 30, 2020 · 8 comments
Closed

Conditional Logic no longer working after upgrade to forms 8.3.0 #273

yorky002 opened this issue Jan 30, 2020 · 8 comments

Comments

@yorky002
Copy link

yorky002 commented Jan 30, 2020

We just upgraded our version of forms from 8.2.0 to 8.3.0 and conditional logic has stopped working.

Have tried saving a change to an existing form.

No js errors are thrown.


This item has been added to our backlog AB#4905

@yorky002
Copy link
Author

yorky002 commented Jan 30, 2020

An update on this:
When conditional logic is applied to a value with spaces the logic does not fire. When a single word value is used in the condition it works fine.

Issue:
Expected value has spaces replaced by +.
Value is as per form (still containing spaces)

Fix applied as follows:
File: App_Plugins/UmbracoForms/Assets/themes/default/umbracoforms.js

Added the following to the self.operators (line 214) for each check:

if (typeof(value) !== 'undefined') { value = value.replace(/ /g, '+'); }

@nul800sebastiaan
Copy link
Member

Thanks for reporting @yorky002, we'll have to investigate. Are you sure this used to work in 8.2.0 with spaces?

@nul800sebastiaan nul800sebastiaan added state/sprint-candidate We're trying to get this in a sprint at HQ in the next few weeks type/bug labels Jan 31, 2020
@lukehook
Copy link

@yorky002 @nul800sebastiaan I'm also seeing this and it was working in 8.2.0 for me also (I'm 99% sure). In my instance I've noticed the following in the console. I don't know if this is related or not

image

@yorky002
Copy link
Author

yorky002 commented Feb 2, 2020

Hi @nul800sebastiaan ,

Yes 100% it used to work prior to the upgrade from 8.2.0 to 8.3.0. Working just before upgrade, not working afterwards.

Cheers,
Kate

@bergmania
Copy link
Member

@bergmania
Copy link
Member

Workaround:

In /Views/Partials/Forms/Themes/default/Script.cshtml use Uri.EscapeUriString instead of HttpUtility.UrlEncode.

The difference is that space is encoded as %20 instead of +. And the javascript in the condition logic decodes %20 back into space.

@umbrabot umbrabot removed the state/sprint-candidate We're trying to get this in a sprint at HQ in the next few weeks label Feb 4, 2020
@Gavlar50
Copy link

Just experienced the unexpected JSON token issue after upgrade to 8.3.0, worked fine on earlier version. Found that line 25 in App_Plugins\UmbracoForms\Assets\themes\default\umbracoforms.js has been updated to:
init({ form: JSON.parse(unescape(formsCollection[i]))});

changed back to
init({ form: formsCollection[i]});

and now the conditional logic works with no js errors

@danielconner
Copy link

Just experienced the unexpected JSON token issue after upgrade to 8.3.0, worked fine on earlier version. Found that line 25 in App_Plugins\UmbracoForms\Assets\themes\default\umbracoforms.js has been updated to:
init({ form: JSON.parse(unescape(formsCollection[i]))});

changed back to
init({ form: formsCollection[i]});

and now the conditional logic works with no js errors

Spent hours trying to the conditions to work trying work-arounds and this finally worked for me! thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants