|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Is there a better way to do this?
statements that need to be rated on a scale of 1 to 5. The survey is for a very specific audience and all of the questions are required. I'm using radio buttons for the ratings and am wondering if I'm handeling this the best way to preserve the user's answers if they missed a question and have to go back to answer. Here is what I have (this would be for each question): <% dim arr1(4) select case session("1") case "5" arr(4) = "SELECTED" case "4" arr(3) = "SELECTED" case "3" arr(2) = "SELECTED" case "2" arr(1) = "SELECTED" case "1" arr(0) = "SELECTED" end select %> 5<input type="radio" name="1" value="5"<%=arr(4)%>> Is there a better, more efficient way to do this?4<input type="radio" name="1" value="4"<%=arr(3)%>> 3<input type="radio" name="1" value="3"<%=arr(2)%>> 2<input type="radio" name="1" value="2"<%=arr(1)%>> 1<input type="radio" name="1" value="1"<%=arr(0)%>> Thanks, -- Jerry Jerry wrote on 15 mrt 2005 in microsoft.public.inetserver.asp.general:
> Here is what I have (this would be for each question): "selected" should be "checked"> <% > dim arr1(4) > > select case session("1") > case "5" arr(4) = "SELECTED" > case "4" arr(3) = "SELECTED" > case "3" arr(2) = "SELECTED" > case "2" arr(1) = "SELECTED" > case "1" arr(0) = "SELECTED" > end select > %> > 5<input type="radio" name="1" value="5"<%=arr(4)%>> <%> 4<input type="radio" name="1" value="4"<%=arr(3)%>> > 3<input type="radio" name="1" value="3"<%=arr(2)%>> > 2<input type="radio" name="1" value="2"<%=arr(1)%>> > 1<input type="radio" name="1" value="1"<%=arr(0)%>> > > Is there a better, more efficient way to do this? > function sel(x) sel = "" if x = session("1") then sel = "checked" end functon %> 5 <input type="radio" name="1" value="5" <%=sel(5)%>> 4 <input type="radio" name="1" value="4" <%=sel(4)%>> 3 <input type="radio" name="1" value="3" <%=sel(3)%>> 2 <input type="radio" name="1" value="2" <%=sel(2)%>> 1 <input type="radio" name="1" value="1" <%=sel(1)%>> -- Evertjan. The Netherlands. (Replace all crosses with dots in my emailaddress) Evertjan. wrote:
> <% I tried to call the function like this:> function sel(x) > sel = "" > if x = session("1") then sel = "checked" > end functon > %> > > 5 <input type="radio" name="1" value="5" <%=sel(5)%>> > 4 <input type="radio" name="1" value="4" <%=sel(4)%>> > 3 <input type="radio" name="1" value="3" <%=sel(3)%>> > 2 <input type="radio" name="1" value="2" <%=sel(2)%>> > 1 <input type="radio" name="1" value="1" <%=sel(1)%>> > <% function sel(x) sel = "" if x = session("1") then sel = " checked" end function call sel(session("1")) %> 5<input type="radio" name="1" value="5"<%=sel(5)%>> I could not get it to work. I'm sorry, I'm not very familiar with ASP 4<input type="radio" name="1" value="4"<%=sel(4)%>> 3<input type="radio" name="1" value="3"<%=sel(3)%>> 2<input type="radio" name="1" value="2"<%=sel(2)%>> 1<input type="radio" name="1" value="1"<%=sel(1)%>> functions. Could you point out what I'm doing wrong here? -- Jerry Jerry wrote on 15 mrt 2005 in microsoft.public.inetserver.asp.general:
Show quote > Evertjan. wrote: No that call does not work. the <%=sel(5)%> is the call>> <% >> function sel(x) >> sel = "" >> if x = session("1") then sel = "checked" >> end functon >> %> >> >> 5 <input type="radio" name="1" value="5" <%=sel(5)%>> >> 4 <input type="radio" name="1" value="4" <%=sel(4)%>> >> 3 <input type="radio" name="1" value="3" <%=sel(3)%>> >> 2 <input type="radio" name="1" value="2" <%=sel(2)%>> >> 1 <input type="radio" name="1" value="1" <%=sel(1)%>> >> > > I tried to call the function like this: > <% > function sel(x) > sel = "" > if x = session("1") then sel = " checked" > end function > > call sel(session("1")) > %> Why do you change my code? do not delete neccessary spaces!> 5<input type="radio" name="1" value="5"<%=sel(5)%>> <input type="radio" name="1" value="5" <%=sel(5)%>> This NG usually and I certainly expect some familiarity or self > 4<input type="radio" name="1" value="4"<%=sel(4)%>> > 3<input type="radio" name="1" value="3"<%=sel(3)%>> > 2<input type="radio" name="1" value="2"<%=sel(2)%>> > 1<input type="radio" name="1" value="1"<%=sel(1)%>> > > I could not get it to work. I'm sorry, I'm not very familiar with ASP > functions. Could you point out what I'm doing wrong here? experiment with ASP. Does a test.asp page with only: <%="Hello World"%> produce Hello World ? -- Evertjan. The Netherlands. (Replace all crosses with dots in my emailaddress) Evertjan. wrote:
Show quote > Jerry wrote on 15 mrt 2005 in microsoft.public.inetserver.asp.general: It didn't work so I experimented a little.> > >>Evertjan. wrote: >> >>><% >>>function sel(x) >>> sel = "" >>> if x = session("1") then sel = "checked" >>>end functon >>>%> >>> >>>5 <input type="radio" name="1" value="5" <%=sel(5)%>> >>>4 <input type="radio" name="1" value="4" <%=sel(4)%>> >>>3 <input type="radio" name="1" value="3" <%=sel(3)%>> >>>2 <input type="radio" name="1" value="2" <%=sel(2)%>> >>>1 <input type="radio" name="1" value="1" <%=sel(1)%>> >>> >>I tried to call the function like this: >><% >>function sel(x) >> sel = "" >> if x = session("1") then sel = " checked" >>end function >> > > >>call sel(session("1")) > > > No that call does not work. the <%=sel(5)%> is the call > > > >>%> >>5<input type="radio" name="1" value="5"<%=sel(5)%>> > > > Why do you change my code? do not delete neccessary spaces! Show quote > <input type="radio" name="1" value="5" <%=sel(5)%>> I'm familiar with ASP. I've just never used functions that much. My job > > >>4<input type="radio" name="1" value="4"<%=sel(4)%>> >>3<input type="radio" name="1" value="3"<%=sel(3)%>> >>2<input type="radio" name="1" value="2"<%=sel(2)%>> >>1<input type="radio" name="1" value="1"<%=sel(1)%>> >> >>I could not get it to work. I'm sorry, I'm not very familiar with ASP >>functions. Could you point out what I'm doing wrong here? > > > This NG usually and I certainly expect some familiarity or self > experiment with ASP. requires a little ASP coding but not much. The code example didn't work so I experimented a little. Obviously I was going the wrong direction. > Does a test.asp page with only: <sigh>> > <%="Hello World"%> > > produce > > Hello World > > ? -- Jerry Jerry wrote on 15 mrt 2005 in microsoft.public.inetserver.asp.general:
>> Does a test.asp page with only: This is not a joke. >> >> <%="Hello World"%> >> >> produce >> >> Hello World >> >> ? > > <sigh> > It is a serious attemt to help you. -- Evertjan. The Netherlands. (Replace all crosses with dots in my emailaddress) Evertjan. wrote:
Show quote > Jerry wrote on 15 mrt 2005 in microsoft.public.inetserver.asp.general: The example above would produce "Hello World".> > >>>Does a test.asp page with only: >>> >>><%="Hello World"%> >>> >>>produce >>> >>>Hello World >>> >>>? >> >><sigh> >> > > This is not a joke. > It is a serious attemt to help you. > -- Jerry Jerry wrote on 15 mrt 2005 in microsoft.public.inetserver.asp.general:
Show quote > Evertjan. wrote: Jerry, the question is not what is WOULD produce, >> Jerry wrote on 15 mrt 2005 in microsoft.public.inetserver.asp.general: >> >> >>>>Does a test.asp page with only: >>>> >>>><%="Hello World"%> >>>> >>>>produce >>>> >>>>Hello World >>>> >>>>? >>> >>><sigh> >>> >> >> This is not a joke. >> It is a serious attemt to help you. >> > > The example above would produce "Hello World". but it is the first debugging test if your asp enging is working. It seems, since as you profes, your knowledge of asp functions is limited, that serious debugging is necessary. -- Evertjan. The Netherlands. (Replace all crosses with dots in my emailaddress) Evertjan. wrote:
Show quote > Jerry wrote on 15 mrt 2005 in microsoft.public.inetserver.asp.general: Ah, I didn't quite understand you earlier. The answer to your question > > >>Evertjan. wrote: >> >>>Jerry wrote on 15 mrt 2005 in microsoft.public.inetserver.asp.general: >>> >>> >>> >>>>>Does a test.asp page with only: >>>>> >>>>><%="Hello World"%> >>>>> >>>>>produce >>>>> >>>>>Hello World >>>>> >>>>>? >>>> >>>><sigh> >>>> >>>This is not a joke. >>>It is a serious attemt to help you. >>> >> >>The example above would produce "Hello World". > > > Jerry, the question is not what is WOULD produce, > but it is the first debugging test > if your asp enging is working. > > It seems, since as you profes, > your knowledge of asp functions is limited, > that serious debugging is necessary. > is yes, that does work. I have various other ASP pages on my website that are also currently working (I just checked after reading your reply). -- Jerry Jerry wrote:
Show quote > Evertjan. wrote: This worked:> >> Jerry wrote on 15 mrt 2005 in microsoft.public.inetserver.asp.general: >> >> >>> Evertjan. wrote: >>> >>>> Jerry wrote on 15 mrt 2005 in microsoft.public.inetserver.asp.general: >>>> >>>> >>>> >>>>>> Does a test.asp page with only: >>>>>> >>>>>> <%="Hello World"%> >>>>>> >>>>>> produce >>>>>> Hello World >>>>>> >>>>>> ? >>>>> >>>>> >>>>> <sigh> >>>>> >>>> This is not a joke. It is a serious attemt to help you. >>>> >>> >>> The example above would produce "Hello World". >> >> >> >> Jerry, the question is not what is WOULD produce, but it is the first >> debugging test if your asp enging is working. >> >> It seems, since as you profes, your knowledge of asp functions is >> limited, that serious debugging is necessary. >> > > Ah, I didn't quite understand you earlier. The answer to your question > is yes, that does work. I have various other ASP pages on my website > that are also currently working (I just checked after reading your reply). > > <% function sel(x) sel = "" if (x*1) = (session("1")*1) then sel = "checked" end function %> 5<input type="radio" name="1" value="5" <%=sel(5)%>> I think the problem was that session("1") was not numeric so it didn't 4<input type="radio" name="1" value="4" <%=sel(4)%>> 3<input type="radio" name="1" value="3" <%=sel(3)%>> 2<input type="radio" name="1" value="2" <%=sel(2)%>> 1<input type="radio" name="1" value="1" <%=sel(1)%>> equal the numeric value of x. -- Jerry Jerry wrote on 15 mrt 2005 in microsoft.public.inetserver.asp.general:
> Ah, I didn't quite understand you earlier. The answer to your question Than the next question is, does this work:> is yes, that does work. I have various other ASP pages on my website > that are also currently working (I just checked after reading your > reply). > > =========== test.asp ============= <% function sel(x) sel = "" if x = session("1") then sel = "checked" end function session("1") = "myTest" %> myTest: <%=sel("myTest")%> <br> yourTest: <%=sel("yourTest")%> ============================ on my system it shows: myTest: checked yourTest: -- Evertjan. The Netherlands. (Replace all crosses with dots in my emailaddress) Evertjan. wrote:
Show quote > Jerry wrote on 15 mrt 2005 in microsoft.public.inetserver.asp.general: I get the same results.> > >>Ah, I didn't quite understand you earlier. The answer to your question >>is yes, that does work. I have various other ASP pages on my website >>that are also currently working (I just checked after reading your >>reply). >> >> > > > Than the next question is, does this work: > > =========== test.asp ============= > > <% > function sel(x) > sel = "" > if x = session("1") then sel = "checked" > end function > > session("1") = "myTest" > %> > > myTest: <%=sel("myTest")%> > <br> > yourTest: <%=sel("yourTest")%> > > ============================ > > on my system it shows: > > myTest: checked > yourTest: > -- Jerry |
|||||||||||||||||||||||