0

I am using Zk framework for UI and from Controller side i need to set the value for the radio.Have a look on below code

radio.setLabel("Phone Number#"+"<span style="+"\" foreground-color:blue \""+">"+cont.getPhone().toString() +"</span>"+"Email Id"+cont.getEmail());

but it is not replacing the color,only color of phone number should be replaced

VinodBokare
  • 41
  • 2
  • 6

5 Answers5

0

Try below line of code

If you want to do in ZUl page try this

 <radio id="radiog" label="Item D" value="itemD" style="color:blue;"/>

otherwise try

radio.setStyle("color:blue;");//Their can be syntax error please modify it according to your requirement. 
JavaBeigner
  • 608
  • 9
  • 28
0

Take a look at my fiddle. I separate your radio in 3 components: 1 radio and 2 labels, all inside 1 div. This is the only simple way I can think of

Fiddle

Code

<zk>
  <window border="normal" title="hello">

    <div>
          <radio id="radio" value="itemD" />
          <label value="Phone: " />
          <label style="color:blue" value="123456" />
    </div>
  </window>
</zk>
AlexGreg
  • 838
  • 10
  • 22
  • Hii my zul is and from controller side i need to set more than one label to radio and in that only phone number should be colored – VinodBokare Sep 05 '14 at 10:37
0

I doubt ZK allows use of HTML code inside the radiobutton label.

I suggest breaking it into smaller pieces like @AlexGreg answer shows, you can even consider using spans or try a CSS approach like the one suggested in https://stackoverflow.com/a/4622818/1385048.

Community
  • 1
  • 1
Repoker
  • 202
  • 3
  • 12
0

You can override the client widget's implementation domLabel_() function as follows:

<radio xmlns:w="client">
    <attribute name="onCreate"><![CDATA[
    self.setLabel("<span style='color:blue'>test</span>");
    ]]></attribute>
    <attribute w:name="domLabel_">
    function () { return this.getLabel(); }
    </attribute>
</radio>
jumperchen
  • 1,463
  • 12
  • 27
0

i acheived this through a piece of code.

first create Outer Hlayout then radio button then inner hlayout created two label's & then set css seperatly set that lable to inner hlayout, inner hlayout to radio and radio to outerlayout.

VinodBokare
  • 41
  • 2
  • 6