SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    <select> tag and submit

    Hi there,

    I'd like to add a simple feature to my site were a user has to select the right answer from a list.

    The code I'm using so far:


    HTML Code:
    <select>
        <option>Select answer</option>
        <option>a</option>
        <option>b</option>
        <option>c</option>
        <option>d</option>
    </select>
    		<input associd="feedback" class="faderIn btn-multiple-choice" id="btnFeedbackRight"  type="button" value="Submit" />
    Obviously the code doesn't do anything once the submit button has been pressed. What do I need to do to make it say "Correct" if say B has been selected?

    Thanks for any help.

  2. #2
    SitePoint Enthusiast Belsnickle's Avatar
    Join Date
    Feb 2012
    Location
    Chico, CA
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to embed it between <form> tags and assign a method as post or get otherwise the whole thing is essentially just a fancy clickable graphic. See here.

  3. #3
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've wrapped the form tags around the question. Would there be a simple way than a method? Such as a simple javascript function saying b is correct, a,c,d are wrong?

  4. #4

    Join Date
    Feb 2012
    Location
    India
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just set javascript function with flags..it will work..

  5. #5
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,564
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Well, do you want it to be automatic message, or let the page reload and do something?

    If the former, JS, if latter, PHP or some other server side language.
    Twitter-@Ryan_Reese09
    http://www.ryanreese.us -Always looking for web design/development work


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •