Welcome to WebmasterWorld Guest from

Forum Moderators: brotherhood of lan & mack

Message Too Old, No Replies

hiding an image

radiobuttonlist, image hiding, server side script, client side script



11:35 am on Jun 14, 2010 (gmt 0)

5+ Year Member


I'm working on this website for my mate for his wedding. This is my first website. Anyway its not going too bad. Well I am putting a quiz about the couple in with multiple choice questions using a radionbutton list. This is an asp.net control, which (I may not require, but might just leave it in there now even if I don't). Anyway so there are going to be like 6 multiple choice questions and you have to choose an answer for each question and click on a submit button.

For the ones that they get wrong I want a red cross to show up on the left side of the radiobutton they selected and a green tick to show up beside the correct answer( on the left side of the corresponding radiobutton). On the ones they get correct well I just want a green tick to show up on the left side of the radio button they selected.

I would post the page I'm talking about, but I"m not sure about the rules of the forum because it is going to have my mate's name on the page and also I'm not sure if this classes as "review my site".

Anyway, the question is. How would one go about this? I thought of making a label element for each radio button that sits on the left of the radio button and has a cross if it's beside an incorrect answer and a tick beside a correct answer. Also, would I be putting the logic in server side code, or putting it in client side code. Also the hiding? Have I go tthe option to do that in server side too? Like changing a visibility attribute or would I do this in javascript.

Also how do I sit the label there? Do I use absolute positioning? I could work out how to do this. Maybe I'm just asking experienced guys here, "what is best practice"?

I can look this up myself and do it "a" way, but maybe not the easiest and most appropriate way. That is why I'm here asking this question.



3:03 am on Jun 15, 2010 (gmt 0)

5+ Year Member

Well I just went ahead and did it. I'm not sure if it's the best way, but it's a way. I used server side. I positioned little crosses and ticks beside the appropriate answers using relative positioning.
I then set them to Visible="False" (I'm using asp:Image tags).
I then just checked the logic on the associated c# file under the submit button clicked method and set the appropriate crosses and or ticks to visible.



3:30 am on Jun 15, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member

would I be putting the logic in server side code, or putting it in client side code

It could go either side, if you need a record of the choices made the server needs to be involved, doing it on the client gives the user near instant feedback, you can use a combination.

On the client side, use JS to set visiblity of tick/cross/blank image based on checked state vs correct answer.


8:55 am on Jun 15, 2010 (gmt 0)

5+ Year Member

Thanks Dave.

Featured Threads

Hot Threads This Week

Hot Threads This Month