ZK - Open Source Ajax Java FrameworkZK - Open Source Ajax Java Framework

How would I initialize radiogroup button to database value?

DanielDinverno
18 Aug 2010 12:01:49 GMT
18 Aug 2010 12:01:49 GMT

How would I initialize radiogroup button to database value in the following code, thanks?

<?page title="Edit Customer" contentType="text/html;charset=UTF-8"?>
<zk>
<window id="editCustomerWin" title="Edit Customer" border="normal">

<zscript><![CDATA[
import com.test.services.CustomerService;
import com.test.base.Customer;
public void submit() {
int l_custId = Integer.valueOf(myCustId.getValue());
Customer cust = new Customer();
cust.setId(l_custId);
cust.setName(customerName.getValue());
cust.setDate(new java.sql.Date(date.getValue().getTime()));
cust.setDeleted(deleted.isChecked());
cust.setCharttype(charttype.getSelectedItem().getValue());
CustomerService custSvc = new CustomerService();
custSvc.updateCustomer(cust);
Executions.getCurrent().sendRedirect("index.zul");
editCustomerWin.detach();
}
]]>
</zscript>

<zscript><![CDATA[
CustomerService custSvc = new CustomerService();
String customerId = (String)Executions.getCurrent().getArg().get("custId");
Customer cust = custSvc.getCustomer(customerId);

]]>
</zscript>
<grid fixedLayout="true" width="600px">
<rows>
<row>
<label value="Customer Name"/>
<textbox id="customerName" constraint="no empty" value="${cust.name }"/>
</row>
<row>
<label value="Date"/>
<datebox id="date" constraint="no empty" value = "${cust.date }"/>
</row>
<row>
<textbox id="myCustId" visible="false" value="${cust.id }"/>
</row>
<row>
<label value="Delete?"/>
<hbox>
<checkbox id="deleted" name="deleted" checked="${cust.deleted}"/>
<label value="whats this?" style="font:9;cursor:help;valign:center"
popup="help"/>
</hbox>
<popup id="help" width="400px">
<html>Checking this box will enable soft delete of the record.</html>
</popup>
</row>
<row>
<label value="Chart Type"/>
<textbox id="chartTyp" value="${cust.charttype }"/>
</row>
<row>
<radiogroup id="charttype">
<radio label="A graph" value="A"/>
<radio label="Z grapgh" value="Z"/>
</radiogroup>
</row>

<row>
<button label="Save" onClick="submit()"/>
<button label="Cancel" onClick="editCustomerWin.detach()"/>
</row>
</rows>
</grid>
</window>
</zk>

terrytornadoTop Contributor
18 Aug 2010 18:10:23 GMT
18 Aug 2010 18:10:23 GMT

Please, post it again with CODE tags and more guys will have a quick look on it !!!!
Means your posted code is not readable on the fly.
Someone who will help you must copy and paste it to their IDE for having a look on it because it's not engaged.

[ c o d e ]

your code here

[ / c o d e ]

PS: For all who want quick help. Please use the [ c o d e ] you code here [/ c o d e ] tags.

best
Stephan

samchuang
22 Aug 2010 09:05:00 GMT
22 Aug 2010 09:05:00 GMT

Hi

initialize radiogroup

refer to javadoc