Opened 12 years ago

Closed 12 years ago

Last modified 9 years ago

#4648 closed defect (worksforme)

Textarea: Can't access the value property

Reported by: guest Owned by: Douglas Hays
Priority: high Milestone: 1.0
Component: Dijit - Form Version: 0.9
Keywords: Cc:
Blocked By: Blocking:

Description

The only way I've found to get the value out of a textarea is by grabbing it from one of its children. To me, this sounds a little ridiculous and the textarea control should operate like the standard HTML control; where you can use the .value property. Attached is some code.

Attachments (1)

test_Textarea.html (2.8 KB) - added by guest 12 years ago.
modified version of test_Textarea. Hit the button "Test" to get the value from "largeTextArea"

Download all attachments as: .zip

Change History (8)

Changed 12 years ago by guest

Attachment: test_Textarea.html added

modified version of test_Textarea. Hit the button "Test" to get the value from "largeTextArea"

comment:1 Changed 12 years ago by bill

Component: GeneralDijit
Milestone: 1.0
Owner: anonymous deleted

Doug, what do you think? Originally I asked for all form widgets to reflect their value in the value attribute, but then Cougar told me that was too expensive for Editor, and that Editor should only compute it's value when asked (thus, the getValue() accessor). So for Textarea, either getValue() or value (or both) should work.

comment:2 Changed 12 years ago by bill

Owner: set to Douglas Hays
Summary: Can't access the value property in a textareaTextarea: Can't access the value property

comment:3 Changed 12 years ago by Douglas Hays

Resolution: worksforme
Status: newclosed

getValue() accessor method is the way to get the value consistently for all form widgets. It seems to work for me.

comment:4 in reply to:  3 Changed 12 years ago by guest

Replying to doughays:

getValue() accessor method is the way to get the value consistently for all form widgets. It seems to work for me.

Could you post what you did because I get "not a function" in firebug. Thanks.

comment:5 Changed 12 years ago by Douglas Hays

<div id="simpleTextArea" name="simpleTextArea" dojoType="dijit.form.Textarea"
        >this is a very simple resizable text area</div>
<button onclick="alert('textarea value = ' + dijit.byId('simpleTextArea').getValue())"
        >Click me to see the value</button>

comment:6 Changed 12 years ago by guest

Oh, I was using dojo.byId instead of dijit.byId. Thanks for your help, Doug.

comment:7 Changed 9 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.