2016-06-13 38 views
0

我的班級:如何保存radion按鈕的Grails

package com 

class Cafe { 

    String cafeteriasurvey 


    static constraints = { 

     cafeteriasurvey nullable:true 
    } 

} 

& form.gsp:

<%@ page import="com.Cafe" %> 


<style> 


h1{ 

text-align:center; 

Color:#680000; 

} 

h2{ 

text-align:center; 

font-weight:normal; 

} 

p{ 

font-style:Arial; 

background-color:#b2b2b2; 

} 

.wrapper{ 

text-align:center; 

} 

.save{ 

text-align:center; 

} 

</style> 

<h1>Cafeteria Survey</h1><br> 


<h2 style="Color:#87212e">Caterer:Abhiruchi Caterers</h2><br> 


<p>1.How would you rate for overall 'Breakfast' food items?</p><br> 


<g:radioGroup name="cafeteriasurvey" 


       values="['Muslim', 'Hindu', 'Christian', 'Buddhist']" 


       labels="['Muslim', 'Hindu', 'Christian', 'Buddhist']" 


       value="${cafeInstance?.cafeteriasurvey}"> 


    <p>${it.label}: ${it.radio}</p> 


</g:radioGroup> 

任何解決方案如何保存單選按鈕。

+0

這是接近足夠的甚至沒有一個grails的問題。你會用什麼來發佈一個項目的HTML?表單 ?一個提交URL的表單,以便 radioButton SUBMIT button then。在嘗試Grails應用程序之前,請先研究一些基本的html材料。 – Vahid

回答