simontegg / hotdrink

Automatically exported from code.google.com/p/hotdrink
0 stars 0 forks source link

Disablement of multi-checkbox and radio button does not work #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Enablement/Disablement algorithm doesn't work now for multi-checkbox and radio 
button.

Here is the test case:

[Sheet]
sheet test {
  interface: {
    x : true;
    a : false; // single checkbox
    b : []; // multiple checkbox
    c : "yes"; // radio
  }
  output:{
    result <== (x == false) ? "nothing" : {a:a, b:b, c:c};
  }
}

[Layout]
<style type="text/css">
#form { border: 1px solid black; padding: 1em; margin: 1em; }
#form label { display: block; }
</style>

<form id="form">
<label>X : <input type="checkbox" id="x"> Enable/Disable all below</input>
<label>A : <input type="checkbox" id="a"></input>
<label>B-1 : <input type="checkbox" id="b" name="b" value="1" /></label>
<label>B-2 : <input type="checkbox" name="b" value="2" /></label>
<label>B-3 : <input type="checkbox" name="b" value="3" /></label>
<label>C : <input type="radio" name="c" value="yes" />Yes <input type="radio" 
name="c" value="no" />No</label>

<button type="button" id="result">OK</button>
</form>

When the checkbox x is off, a, b, c widgets should be disabled automatically 
but only the single checkbox is disabled well.

From the log I can see that the algorithm detects all of them can be disabled 
but disablement behavior didn't trigger for b and c.

log: model.js:187: Starting analysis for enablement behavior...
log: behavior/enablement.js:137: result is relevant.
log: behavior/enablement.js:137: x is relevant.
log: behavior/enablement.js:277: interface variable x can not be disabled
log: behavior/enablement.js:277: interface variable a can be disabled
log: behavior/enablement.js:277: interface variable b can be disabled
log: behavior/enablement.js:277: interface variable c can be disabled
log: behavior/enablement.js:273: output variable result can not be disabled
log: model.js:189: Finished analysis for enablement behavior.
log: controller/model.js:66: Refreshing view...
log: controller/behavior/value.js:75: writing #x
log: controller/behavior/value.js:75: writing #result
log: controller/behavior/enablement.js:64: disabling #a
log: controller/model.js:75: Refreshed.

Original issue reported on code.google.com by guruw...@gmail.com on 14 Feb 2011 at 6:37

GoogleCodeExporter commented 9 years ago
Note to self: the fix is to add an enabler/disabler for html-checkbox-multi and 
html-radio to /javascript/hotdrink/lib/controller/bind/html.js

Original comment by jfreema...@gmail.com on 15 Feb 2011 at 8:23

GoogleCodeExporter commented 9 years ago

Original comment by jfreema...@gmail.com on 18 Feb 2011 at 5:30

GoogleCodeExporter commented 9 years ago
I committed this example as "Multi-element widgets" in [examples 4bd4134].

Original comment by jfreema...@gmail.com on 18 Feb 2011 at 10:56

GoogleCodeExporter commented 9 years ago
Fixed in [examples 9f2b076]. I slightly revamped the widget support system in 
preparation for this fix.

Original comment by jfreema...@gmail.com on 21 Feb 2011 at 9:39