I have 3 radio buttons which when selected, will run different query.
I have no idea how the if-else condition works for grails radio buttons as I’m completely new to grails..
this is my gsp page.
<label>Search id:</label><input type = "text" name = "searchid1">
<input type ="submit" name ="search" value ="Go!">
<br>
<g:radio name="myGroup" value="input1"/>
<g:radio name="myGroup" value="input2"/>
<g:radio name="myGroup" value="input3"/>
and the queries at the controller site..
String searchQ1 = "select * from alert_list where id = " + params.searchid1
def searchit1 = sql.rows(searchQ1)
String searchQ2 = "select * from Admin where id = " + params.searchid1
def searchit2 = sql.rows(searchQ2)
String searchQ3 = "select * from sec_user where id = " + params.searchid1
def searchit3 = sql.rows(searchQ3)
[searchit1: searchit1, searchit2: searchit2, searchit3: searchit3]
the method you’re using for GSP is correct. However, in the controller you need to add in IF-ELSE statement.
Add the if-else condition in your controller and your problem will be fixed.