1

I'm trying to create a form Polymer component where form elements are generated on the fly. I've looked, and so far the only way to bind the value attribute is by using .injectBoundHtml. This does not work with all component types, I'm trying to bind the value of a <textarea>, and this is what I get:

Removing disallowed attribute <TEXTAREA value="{{ results[ "comments" ] }}">

My work around was to add: textareaID.addEventListener('change', updateValueMap)

I'm hoping someone could tell me why value is disallowed, and/or if there is a better way to programmatically assign bound attributes in Polymer. Please :)!

Thanks to Gunter's suggestion, and passing a node validator:

var val = new NodeValidatorBuilder.common()
  ..allowElement('textarea', attributes:['value']);
this.injectBoundHtml(getElementStr(i), element:selP, validator:val);
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
Alex L.
  • 416
  • 1
  • 4
  • 14

1 Answers1

1

Textarea doesn't have a value attribute. Try this instead

<textarea>{{results['comments']}}</textarea>

For more information about the message Removing disallowed attribute see How to create shadow DOM programmatically in Dart?

Community
  • 1
  • 1
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
  • Thank you, but `````` doesn't work while using ```injectBoundHtml``` . It looks like it only likes to bind attributes, not content. – Alex L. Apr 29 '15 at 07:41
  • 1
    I got it working by way of a ```NodeValidatorbuilder``` ```var val = new NodeValidatorBuilder.common() ..allowElement('textarea', attributes:['value']); this.injectBoundHtml(getElementStr(i), element:selP, validator:val); ``` – Alex L. Apr 29 '15 at 07:57