powerparin / gwt-ext

Automatically exported from code.google.com/p/gwt-ext
0 stars 0 forks source link

field.setFieldLabel() does not work after field is rendered. #466

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a form panel, add a fieldset to it and add two textfields to the 
field set.
2. Try changing the label of field1 onBlur of field2. 

What is the expected output? What do you see instead?
Expected output is the new fieldlabel along with the proper label 
separator.
What is seen now is the label separator disappears and html is not 
recognized. Wanted to make the field label bold and what appeared instead 
is <b>Label</b>. 

What version of the product are you using? On what operating system?
Using GWT 2.0.5 on XP

Please provide any additional information below.

Original issue reported on code.google.com by pravi.g...@gmail.com on 16 Jan 2009 at 5:53

GoogleCodeExporter commented 8 years ago
I find this problem too. Here is my solution, maybe will help you.

  private void refreshLabel() {
    if (!isHideLabel()) {
      String caption = null;
      if (required && !isReadOnly() && !isDisabled())
        caption = getFieldCaption() + "<font color='red'> * </font>";
      else
        caption = getFieldCaption();
      if (isRendered()) {
        Element fieldContainerElement = DOM.getParent(DOM.getParent(this.getElement
()));
        Element fieldLabelElement = DOM.getChild(fieldContainerElement, 0);
        DOM.setInnerHTML(fieldLabelElement, caption);
      } else {
        super.setFieldLabel(caption);
      }
    }
  }

Original comment by sharemet...@gmail.com on 3 Feb 2009 at 2:51