From: weiwei on
Hi
I have a record input in radio button style and store in the database,
then user query it out and display in radio button style in the form.
Then if that user changes his mind and want to reselect other choice,

So far, I am reaching the last part, every time user selected another
radio button and click submit, I still see the old radio button result
instead of new one.

Any idea??? (below is my example code)
thanks in advance

First page to select radio button and hit submit

<td class="cat">Quickly builds rapport and identifies customer’s
needs in order to book rental.</td>

<td class="catc"><input type="radio" name="num1" value="1" /></td>

<td class="catc"><input type="radio" name="num1" value="2" /></td>

<td class="catc"><input type="radio" name="num1" value="3" /></td>

<td class="catc"><input type="radio" name="num1" value="4" /></td>

<td class="catc"><input type="radio" name="num1" value="5" /></td>

</tr>



Second page I pick it up the variable and do a select case statement,
if user chose choice 1 and it will show up as choice 1. now if user
change mind and want to change to choice 2, I can do it from it
screen, and click submit, I will getting choice 1 instead of new
choice 2



<% strnum1 = request.form(“num1”) %>

<% Select Case strnum1 %>

<% Case 1 %>

<td class="catc"><input type="radio" name="num1" value="1" Checked /></
td>

<td class="catc"><input type="radio" name="num1" value="1" /></td>

<td class="catc"><input type="radio" name="num1" value="1" /></td>

<td class="catc"><input type="radio" name="num1" value="1" /></td>

<td class="catc"><input type="radio" name="num1" value="1" /></td>

<% case 2 %>

<td class="catc"><input type="radio" name="num1" value="2" /></td>

<td class="catc"><input type="radio" name="num1" value="2" Checked /></
td>

<td class="catc"><input type="radio" name="num1" value="2" /></td>

<td class="catc"><input type="radio" name="num1" value="2" /></td>

<td class="catc"><input type="radio" name="num1" value="2" /></td>

</ End Select %>
From: Adrienne Boswell on
weiwei <weihuangzhu(a)gmail.com> wrote in news:f6feaa4b-c19c-409e-ac26-
241e2ecf23ed(a)e27g2000yqd.googlegroups.com:

> Hi
> I have a record input in radio button style and store in the database,
> then user query it out and display in radio button style in the form.
> Then if that user changes his mind and want to reselect other choice,
>
> So far, I am reaching the last part, every time user selected another
> radio button and click submit, I still see the old radio button result
> instead of new one.
>
> Any idea??? (below is my example code)
> thanks in advance
>
> First page to select radio button and hit submit
>
> <td class="cat">Quickly builds rapport and identifies customer�s
> needs in order to book rental.</td>
>
> <td class="catc"><input type="radio" name="num1" value="1" /></td>
>
> <td class="catc"><input type="radio" name="num1" value="2" /></td>
>
> <td class="catc"><input type="radio" name="num1" value="3" /></td>
>
> <td class="catc"><input type="radio" name="num1" value="4" /></td>
>
> <td class="catc"><input type="radio" name="num1" value="5" /></td>
>
> </tr>
>
>
>
> Second page I pick it up the variable and do a select case statement,
> if user chose choice 1 and it will show up as choice 1. now if user
> change mind and want to change to choice 2, I can do it from it
> screen, and click submit, I will getting choice 1 instead of new
> choice 2
>
>
>
> <% strnum1 = request.form(�num1�) %>
>
> <% Select Case strnum1 %>
>
> <% Case 1 %>
>
> <td class="catc"><input type="radio" name="num1" value="1" Checked />
</
> td>
>
> <td class="catc"><input type="radio" name="num1" value="1" /></td>
>
> <td class="catc"><input type="radio" name="num1" value="1" /></td>
>
> <td class="catc"><input type="radio" name="num1" value="1" /></td>
>
> <td class="catc"><input type="radio" name="num1" value="1" /></td>
>
> <% case 2 %>
>
> <td class="catc"><input type="radio" name="num1" value="2" /></td>
>
> <td class="catc"><input type="radio" name="num1" value="2" Checked />
</
> td>
>
> <td class="catc"><input type="radio" name="num1" value="2" /></td>
>
> <td class="catc"><input type="radio" name="num1" value="2" /></td>
>
> <td class="catc"><input type="radio" name="num1" value="2" /></td>
>
> </ End Select %>


This is how I do things like this. First of all, almost all forms I do
post to themselves, and avoid these kind of issues. You are also using
XHTML syntax which required that all attributes have values, eg:
checked="checked" is valid, while just checked is not. That might also
have something to do with it.

<% num1 = request.form("num1") %>

<input type="radio" name="num1" value="1" <% if num1="1" then%>
checked="checked"<%end if%> />


or you can use a function:

<input type="radio" name="num1" value="1" <%=chkchkd(1,num1)%> />

<%
function chkchkd(value,selected)
if value = selected then
chk = "checked=" & chr(34) & "checked" & chr(34)
else
chk = ""
end if

chkchkd = chk
end function
%>

heck, you can even put it through a loop:

<% for i = 1 to 5 %>
<input type="radio" name="num1" value="<%=i%>" <%=chkchkd(i,num1)%> />
<% next%>

--
Adrienne Boswell at work
Please respond to the group so others can share
nextBlock.com
http://nextblock.com/