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.

Unable to set default boolean USER_INPUTS value to YES

See original GitHub issue

Description

We set up some template with some boolean USER_INPUTS like explained in the documentation but sunstone eith:

  • always ask to select a value
  • freeze with the following error in the console
    Uncaught Error: Syntax error, unrecognized expression: :radio[name="bool_one98" value="]
        jQuery 4
            error
            tokenize
            Sizzle
            find
        validateRadio foundation.js:2162
        validateInput foundation.js:2043
        validateForm foundation.js:2098
        jQuery 2
            each
            each
        validateForm foundation.js:2097
        _events foundation.js:1824
        jQuery 8
            dispatch
            handle
            trigger
            trigger
            each
            each
            trigger
            name
        _submitFormPanel sunstone.js:1085
        setTimeout handler*_submitFormPanel sunstone.js:1082
        _insertButtonsInTab sunstone.js:545
        jQuery 2
            dispatch
            handle
    jquery.js:1468
        jQuery 4
        validateRadio foundation.js:2162
        validateInput foundation.js:2043
        validateForm foundation.js:2098
        jQuery 2
        validateForm foundation.js:2097
        _events foundation.js:1824
        jQuery 8
        _submitFormPanel sunstone.js:1085
        (Async: setTimeout handler)
        _submitFormPanel sunstone.js:1082
        _insertButtonsInTab sunstone.js:545
        jQuery 2
    

To Reproduce

  1. Download the Ubuntu-20.04 App
  2. Update the template to add the following USER_INPUTS, Sunstone produce the following:
    USER_INPUTS=[
      DEFTRUE="M|boolean|try default to yes| |YES" ]
    
  3. Instanciate the VM

Expected behavior

The VM should instanciate without any issue and the DEFTRUE context valiable should be set to YES

Details

  • Affected Component: Sunstone
  • Hypervisor: KVM
  • Version: 5.12.0.1-1.ce

Additional context

  • Everything is working fine when the default value is NO like:
    USER_INPUTS=[
      DEFTRUE="M|boolean|try default to yes| |YES" ]
    
  • There is an issue in the documentation, a | seems to be missing between <desc> and <default> since it describe the boolean as:
    <VAR>=”M|boolean| <desc>|<default>|”
    

Regards.

Progress Status

  • Branch created
  • Code committed to development branch
  • Testing - QA
  • Documentation
  • Release notes - resolved issues, compatibility, known issues
  • Code committed to upstream release/hotfix branches
  • Documentation committed to upstream release/hotfix branches

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
baby-gnucommented, Oct 1, 2020

Thanks a lot @sbbarragan, @tinova.

I patched my Sunstone and it’s working.

0reactions
sbbarragancommented, Oct 1, 2020

That will be fixed in the next release, you can patch manually:

diff --git a/src/sunstone/public/app/utils/user-inputs.js b/src/sunstone/public/app/utils/user-inputs.js
index 8c83f8029..b70b12099 100644
--- a/src/sunstone/public/app/utils/user-inputs.js
+++ b/src/sunstone/public/app/utils/user-inputs.js
@@ -855,7 +855,7 @@ define(function(require) {
         var id = UniqueId.id();
         if(value == "YES"){
           input = "<br>" + Locale.tr("YES ") + "<input style='margin-right: 20px' checked type='radio' name='bool_" +id + "' value='YES'" + wizard_field + " " + required + "/>";
-          input += Locale.tr("NO ") + "<input type='radio' name='bool_" + id + "\" value='NO'" + wizard_field + " " + required + "/>";
+          input += Locale.tr("NO ") + "<input type='radio' name='bool_" + id + "' value='NO'" + wizard_field + " " + required + "/>";
         } else if(value == "NO"){
           input = "<br>" + Locale.tr("YES ") + "<input style='margin-right: 20px' type='radio' name='bool_" + id + "' value='YES'" + wizard_field + " " + required + "/>";
           input += Locale.tr("NO ") + "<input checked type='radio' name='bool_" + id + "' value='NO'" + wizard_field + " " + required + "/>"
Read more comments on GitHub >

github_iconTop Results From Across the Web

Mistakenly set Boolean attribute to Yes in lightning
In JavaScript, we have Truthy and Falsy values. As long as the value is truthy, then aura:if will render its true path, and...
Read more >
How to set a default value on a Boolean in a Code First model?
Another option is create a default constructor and set the properties with the default values you need: public class Revision { public Boolean...
Read more >
Boolean inputs are not actually booleans · Issue #1483 - GitHub
My workaround is use ${{needs.defaults.outputs.myoutput == true rather than relying on myoutput to "be a boolean". Here's a full test-case that ...
Read more >
Not able to set update a module entry with a Boolean variable
I am just not able to figure out how to update the value. In "Update module entry" the variable is displayed as text,...
Read more >
4.9 — Boolean values - Learn C++
Boolean variables are variables that can have only two possible values: true, and false. To declare a Boolean variable, we use the keyword...
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