Ternary Operation changing space before : (colon) to + (plus) concatenating as string

Wappler Version : 3.7.3
Operating System : Mac OS 10.15.6
Server Model: PHP
Database Type: MySQL
Hosting Type: Custom Hosting (AMPPS)

Expected behavior

What do you think should happen?

Manually typing in the following ternary operation in the “Code” tab of the data picker value for a dynamic link attribute should keep a space between inspections’ and colon like below

browser1.location.search ? '../api/get_inspections'+browser1.location.search+'&export=inspections' : '../api/get_inspections&export=inspections'

Actual behavior

What actually happens?

Upon saving, it concatenates the colon to the preceding text like below.

browser1.location.search ? '../api/get_inspections'+browser1.location.search+'&export=inspections'+: '../api/get_inspections&export=inspections'

How to reproduce

  • Detail a step by step guide to reproduce the issue
  • A screenshot or short video indicating the problem
  • A copy of your code would help. Include: JS, HTML.
  • Test your steps on a clean page to see if you still have an issue

Create a ternary operation similar to mine for a dynamic link attribute and save.

A work around is simply removing the + and putting the space back in the code view. However, sometimes it reverts back upon saving but I believe that only happened once.

I’d suggest putting () around your complex expressions. Like:

browser1.location.search ? ('../api/get_inspections' + browser1.location.search + '&export=inspections') : '../api/get_inspections&export=inspections'

Thanks @Teodor, that did the trick. Completely forgot to try that. Between coding and learning Wappler it’s been quite the week haha

Thanks again!


Fixed in Wappler 5.1

This topic was automatically closed after 47 hours. New replies are no longer allowed.