The only workaround that occurs to me is to set the attribute manually 
through DOM API

var checkOne = true;

var template = domplate(
{
  tag:
    FORM({name:"resform"},
      BR(),
      INPUT({name:"radiolocator", type: "radio"}),
      SPAN("one"),
      INPUT({name:"radiolocator", type: "radio", class: "two"}),
      SPAN("two")
     ), 
});


var node = template.tag.replace({check1:checkOne}, parentNode, template);
if (checkOne)
   node.querySelector(".two").setAttribute("checked", "true");

---

Fixing: Issue 6018 <http://code.google.com/p/fbug/issues/detail?id=6018>: 
Support 
for IF tag in Domplate is fixed.
would help here I guess

---

Or, we could introduce new rule:
If constructor attribute name begins with "%"* *and the actual value of the 
attribute is true (boolean) a new attribute with the same name (without 
"%") is inserted into the DOM element.

See all naming rule at the bottom of this page
http://www.softwareishard.com/blog/planet-mozilla/domplate-examples-part-i/

Honza



On Wednesday, January 2, 2013 12:16:06 PM UTC+1, Maheeka Jayasuriya wrote:
>
> Hi All,
>
> I have an issue in using radio buttons in a form. I want to check/uncheck 
> the radio button based on a variable passed. My code is as follows :
>
> *var checkOne ="false"
>
> var template = domplate(
>   {    
>   tag: 
>     FORM({name:"resform"},
>       BR(),
>       INPUT({name:"radiolocator", type: "radio"}),  
>       SPAN("one"),
>       INPUT({name:"radiolocator", type: "radio"}),
>       SPAN("two")                
>      ), 
> }
> )
> ;
>
> template.tag.replace({check1:checkOne}, parentNode, template);*
>
> In standard html checked attribute inside radio input would itself check 
> the element without considering the value. But here I want to check either 
> radio button "one" or "two" based on the variable "check1". I need to use 
> like INPUT({name:"radiolocator", type:"radio",checked:"$check1"}),
>
> Is there a work around??
>
> Thanks in advance !
>
> Maheeka
>

-- 
You received this message because you are subscribed to the Google
Groups "Firebug" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
https://groups.google.com/forum/#!forum/firebug

Reply via email to