Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #742 (closed defect: invalid)

Opened 13 years ago

Last modified 12 years ago

TextArea value-setting inconsistent with other widgets

Reported by: andy@… Owned by: anonymous
Priority: normal Milestone:
Component: TG Widgets Version: 0.9a4
Severity: normal Keywords:
Cc:

Description

using 0.9a4.

class Form(w.WidgetsList?):

desc = w.TextArea?(label="Description", default="wrongtext")

in controller:

form.get_field_by_name("desc").attrsvalue? = "correct text"

result: <textarea value="correct text">wrongtext</textarea>

If there's a better way to do what I'm trying to do, please also point this out? :) Thanks -- Andy

Change History

comment:1 Changed 13 years ago by michele

  • Status changed from new to closed
  • Resolution set to invalid

As you can see:

 http://www.w3schools.com/tags/tag_textarea.asp

A textarea tag doesn't support a "value" attribute, that's what you are trying to set by using attrs.

Second point, you shouldn't modify attributes of a widget in this way since this is not thread-safe.

You don't need get_field_by_name (me wants private methods, I will probably rename it to _get_field_by_name).

What you need is passing at display time the value you want to give to your TextArea? widget:

def add(self, ...)
    value = dict(desc="correct text")
    return dict(form=form, value=value)

in your template

Note: See TracTickets for help on using tickets.