membuat radio dalam radiogroup zk

Membuat komponen radio dalam radiogroup menggunakan zk framework

Bismillah

q> buat file cobaRadio.zul


<zk>
 <window apply="org.zkoss.bind.BindComposer"
 viewModel="@id('vm')@init('com.ipi.zk7.mywebzk7.CobaRadioVM')"
 validationMessages="@id('vmsgs')">
 <label value="Pilih Gender :"/>
 <separator/>
 <radiogroup selectedItem="@bind(vm.gender)" >
 <radio label="Pria" value="pria"/>
 <separator/>
 <radio label="Wanita" value="wanita"/>
 </radiogroup>
 <separator />
 <button onClick="@command('simpan')" label="Tes" />

 </window>
</zk>

q> buat file CobaRadioVM.java


package com.ipi.zk7.mywebzk7;

import org.zkoss.bind.annotation.Command;
import org.zkoss.zul.Messagebox;

public class CobaRadioVM {

 private String gender;

public String getGender() {
 return gender;
 }

public void setGender(String gender) {
 this.gender = gender;
 }

 @Command
 public void simpan(){
 Messagebox.show("Gender = " + gender);
 }

}

q> Hasil

Selection_013

Selection_014

Published by

saifiahmada

Begin a big Process with a bit trying

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s