question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Show warning if select_multiple value has spaces

See original GitHub issue

@theywa, it may be interesting and useful to follow the procedure of getting the feature you added in Enketo Core, activated in Enketo Express. In this case, I expect it to be straightforward, but it will be good to test and this way you can also see how translation strings get added to Enketo Express and how the modal dialog works (automagically).

  • update enketo-core package.json (the commit that added the feature or the latest enketo-core commit)
  • npm install and then run with grunt develop
  • update changelog of enketo-express (just copy entry from enketo-core)
  • do final test with actual forms. There are two methods I use:
  1. Upload a form to e.g. KoBoCAT and then manually make an API call to your local enketo-express installation with that form, using the POST /survey api call. After that you can open your form in the browser using the returned URL.
  2. Upload a form anywhere on a webserver and use the http://localhost:8005/preview?form=http://theurl/to/form.xml
  • You should be seeing the nice modal dialogs instead of window.alert.
  • While running grunt develop the new translation key should have been automatically detected and added to /locales/src/en/translation.json. You have to copy the English string that you used in fake-translator.js in enketo-core). Once the commit is pushed to master, the translators will be automatically alerted that there is a new string to be translated (in Transifex).

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
theywacommented, Aug 7, 2019

@MartijnR - I create PR in enketo-core

1reaction
theywacommented, Aug 6, 2019

@MartijnR, I found an issue when testing. The modal dialog only showed the last alert message like this test-result1 when it supposedly showed 3 alerts. My guess this happens because of the modal dialog worked differently than the alert window. Alert window will pause the load process until the user closes it and the modal dialog will be fired after the process is done so the message got override with the new one. I think maybe we can save all the message on an array then call the dialog.alert at the end of the loop with all the array of message joined with break line, like

if ( multiple && ( value.indexOf( ' ' ) > -1 ) ) {
      alerts[alerts.length] = t( 'alert.valuehasspaces.multiple', { value: value } );
} 
...
if ( alerts.length > 0 ) {
      dialog.alert( alerts.join("<br>") );
}

and the modal dialog will look like test-maybe-solution or we can just join the value in 1 message like test-maybe-solution2

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solved: Spaces in choices name
Solved: When having choice names with spaces in them my form converts with warnings, I get that it is probably best to not...
Read more >
Javascript Get Values from Multiple Select Option Box
The for loop is getting one extra run. Change for (x=0;x<=InvForm.SelBranch.length;x++). to for (x=0; x < InvForm.SelBranch.length; x++).
Read more >
How to get multiple selected values of select box in php?
Selecting multiple values in HTML depends on operating system and browser. For window users – hold down + CTRL key to select multiple...
Read more >
ipywidgets Documentation
Question: When I display a widget or interact, I just see some text, such as IntSlider(value=0) or interactive(children=(IntSlider(value=0, ...
Read more >
Macro to select multiple values in the single field
Solved: I need to select multiple values in the single field Example: County ... Hi Jerry what if one of the fields has...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found