navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

form validation script ranking order question

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> form validation script ranking order question
Page: [1]
 
TimC

 

Posts: 199
From: Greenville SC (& or) Monterrey Mexico
Status: offline

 
form validation script ranking order question - 7/5/2007 19:46:49   
Has anyone come across a simple way to do the following ?

I need to ask a question that has 6 answers, the user needs to number each of the answers with a ranking order ranging from most like me to least like me ( these will map to numerical values of 1-6) - i need to make sure that each ranking is used only once and that each question is answered.
I wanted to use something on the style of "radio buttons" since most people are familiar with the old paper scantron cards where you colored in the appropriate circle. (Hey a lot of us older guys did not have computers when we were in school - grin)
I had the idea of "rotating my matrix" of radio buttons vertical instead of horizontal and placed them inside a table. This gauranteed that only one of the 6 answers could be numbered as 1, only one could be numbered as 2, and so on. unfortunately the logic of that fell apart when i could give one answer all 6 rankings - back to the drawing board - any ideas ?

_____________________________

TimC
" Today is so mixed up that I should have stood in bed"
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: form validation script ranking order question - 7/6/2007 13:06:46   
If you haven't got a nice clean solution yet, you may need to look at a JavaScript.

It probably would not be a canned script out there but I can see keeping your transposed (sideways) matrix and setting the value of the radio in each group the question number. You already have the radio groups in columns instead of rows coorect?

Then you could have the JavaScript check the value of the first radio group. If any of the other radio groups have that same value, then there are 2 choices for that question selected. I would run that each time a radio was selected so you can catch the errors right away.

Then you deal with the error in however you choose. You could 'return false' and disallow the selection with an alert.

I could do it but it would take a bit more than the 10 minutes per post I restrict myself to. :) But this might get you started. It's a script I use often to determine which radio in a group is selected:

function getSelectedRadio() {
//a variable that will hold the index number of the selected radio button
var theone
for (i=0;i<document.myFormName.myRadioName.length;i++){
if (document.myFormName.myRadioName[ i ].checked==true){
theone=i;
return i;
break //exist for loop, as target acquired.
}
}
return -1;
}


Then you'd use the returned value to grab the actual radio value. That *should* return the question that the radio group (or column) has selected.

Did that make any sense at all? It will take a little JavaScript comfort but is 'do-able'.

Hope it helps.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to TimC)
TimC

 

Posts: 199
From: Greenville SC (& or) Monterrey Mexico
Status: offline

 
RE: form validation script ranking order question - 7/7/2007 16:09:06   
Si Señor, muchas gracias.
Must have been having a total brain meltdown the other day. Never even thought of javascript - duh - I was getting ready to toss the whole blooming mess and rewrite in asp.net and see if i couldn't emulate it that way. Didn't have my visual studio here in Mx., so I just finished installing the visual web express freebee on my laptop. Glad I looked at your post before I clicked yes on delete all - grin.

Not a real javascript genius but I think I can hack out something if i have a starting point such as the one you provided - Thanks again

_____________________________

TimC
" Today is so mixed up that I should have stood in bed"

(in reply to TimC)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> form validation script ranking order question
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts