Solved

Frontpage radiobutton onclick page reloads then radio button is not selected anymore

Posted on 2004-08-05
6
413 Views
Last Modified: 2006-11-17






This is my form.. I use radio buttons to select a certian size, it works well. but when the page reloads the radio button which is selected is not selected, i.e. none of the radio buttons are selected anymoren, i want the selected radio button to still be selected when the page reloads..


>>> following code by arroentz
Yes, you would use a form (called form1), and instead of links you would use Radio Buttons or a dropdown:

<input type=radio name=size onclick="window.form1.submit()" value="<%=FP_FieldURL(fp_rs,"ProductID") & "|" & FP_FieldURL(fp_rs,"Size1")%>"> <%=FP_FieldURL(fp_rs,"Size1")%><br>
<input type=radio name=size onclick="window.form1.submit()" value="<%=FP_FieldURL(fp_rs,"ProductID") & "|" & FP_FieldURL(fp_rs,"Size2")%>"> <%=FP_FieldURL(fp_rs,"Size2")%><br>
<input type=radio name=size onclick="window.form1.submit()" value="<%=FP_FieldURL(fp_rs,"ProductID") & "|" & FP_FieldURL(fp_rs,"Size3")%>"> <%=FP_FieldURL(fp_rs,"Size3")%><br>


That will submit the form to itself when the size is selected.  Then to access the info:

if request("size") <> "" then
arr = split(request("size"), "|")   'split on PIPE symbol added above
productid = arr(0)
size = arr(1)
response.write "Product: " & productid & "<br>"
response.write "Size: " & size & "<br>"
end if

to see a similar working model

go to www.homenlinens.com  click on one of the linen pictures and then select one of the sizes from the radio button, you will see the page reloading but the selcted size is not selected anymore...
0
Comment
Question by:Ricky11
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 7

Expert Comment

by:mantarae
ID: 11728328
You need to add a bit of code to each radio button:
<%if CStr(FP_FieldURL(fp_rs,"Size1")) = CStr(size) then response.write " CHECKED" end if%>

like so:

<input type=radio name=size onclick="window.form1.submit()" value="<%=FP_FieldURL(fp_rs,"ProductID") & "|" & FP_FieldURL(fp_rs,"Size1")%>"<%if CStr(FP_FieldURL(fp_rs,"Size1")) = CStr(size) then response.write " CHECKED" end if%>> <%=FP_FieldURL(fp_rs,"Size1")%><br>
<input type=radio name=size onclick="window.form1.submit()" value="<%=FP_FieldURL(fp_rs,"ProductID") & "|" & FP_FieldURL(fp_rs,"Size2")%>"<%if CStr(FP_FieldURL(fp_rs,"Size2")) = CStr(size) then response.write " CHECKED" end if%>>  <%=FP_FieldURL(fp_rs,"Size2")%><br>
<input type=radio name=size onclick="window.form1.submit()" value="<%=FP_FieldURL(fp_rs,"ProductID") & "|" & FP_FieldURL(fp_rs,"Size3")%>"<%if CStr(FP_FieldURL(fp_rs,"Size3")) = CStr(size) then response.write " CHECKED" end if%>>  <%=FP_FieldURL(fp_rs,"Size3")%><br>
0
 

Author Comment

by:Ricky11
ID: 11751174
I have changed the code as follows so it is more easier, but i have added your code but it still does not allow the radio button to be marked.

here is my website www.homenlinens.com  click on one of the two linens and then it will take you to table.asp where it should show the availavble sizes and some radio buttons click on the radio buttons and see that it does not highlight.

Code as follows :

      <form name="form1" method="post">
       
         <% c=1
DO while (FP_FieldURL(fp_rs,"Size" & c)) <> ""      
  %>
     
<input type=radio name=size onclick="PostPage('<%=FP_FieldURL(fp_rs,"Size" & c)%>','<%=FP_FieldURL(fp_rs,"ProductID")%>');return false;"><%if CStr(FP_FieldURL(fp_rs,"Size" & c)) = CStr(size) then response.write " CHECKED" end if%>
              <%=unescape(FP_FieldURL(fp_rs,"Size" & c))%><br>
             
              <%      
       c=c+1
LOOP
  %>
    </form>              
0
 
LVL 7

Accepted Solution

by:
mantarae earned 500 total points
ID: 11762327
I think the problem may be the "" vs %22 in the size.  

So, add this code in your page, and post the output:

<form name="form1" method="post">
<% c=1

Response.Write "size=" & CStr(size) & "<BR>"

DO while (FP_FieldURL(fp_rs,"Size" & c)) <> "" %>
     Response.Write "item=" & CStr(FP_FieldURL(fp_rs,"Size" & c)) & "<BR>"

<input type=radio name=size onclick="PostPage('<%=FP_FieldURL(fp_rs,"Size" & c)%>','<%=FP_FieldURL(fp_rs,"ProductID")%>');return false;"><%if CStr(FP_FieldURL(fp_rs,"Size" & c)) = CStr(size) then response.write " CHECKED" end if%>
              <%=unescape(FP_FieldURL(fp_rs,"Size" & c))%><br>
             
<%  c=c+1
LOOP %>
</form>
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:Ricky11
ID: 11764533
Sorry I tried that,.,

I think the only difference was

   Response.Write "size=" & CStr(size) & "<BR>"


but even after adding that line the effect is teh same, i.e. the radio button still does not remain active when it is selected.

any other ideas.

thanks.
0
 
LVL 7

Expert Comment

by:mantarae
ID: 11764729
Could you please post the output when you added the 2 Response.Writes ?
0
 

Author Comment

by:Ricky11
ID: 12004611
Sorry for the long delay

Even after adding the second response.write the output is very messy. it still does not make the radio button stick.

I am going back to the original code, and then I will repost this questions again.

Thanks.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
is this a cms? 8 92
MS SQL 2008 and stored prodcures and dates 5 35
How to post data to an API using ASP Classic 3 51
Help with Classic ASP - Parameterizing Query 16 67
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question