Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jan 2008
    Posts
    13
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Need help validating a multi-field form for an educational game

    Hello,

    I'm working on a cryptogram game for an educational site. The cryptogram will be displayed like scrabble tiles, and letter will have a corresponding text box. So for a five-letter word, there will be five scrabble tiles with five small text boxes beneath for students to fill in individual letters. At the end there will be a validate button that tells them if they have all the letters right or not.

    I found a reference to this solution in the forum: http://www.clickfind.com.au/javascri...tion/index.cfm. It looks to me like this will work but I can't figure out how to modify it to check for specific values.

    I've posted an example of my table below in case it's useful to a helpful person out there. I realize it's not much of a start.

    Thanks in advance for your help,

    ransomcat



    Code:
    <form>
    
    <table id="cryto_one" class="crypto" cols="15">
    	<tr>
    		<td><img src="tiles/20wide/4.gif" /></td> <td>&nbsp;</td> <td><img src="tiles/20wide/!.gif" /></td> <td><img src="tiles/20wide/3.gif" /></td>   
    	</tr>
    
            <tr>
    		<td><input name="four" type="text" class="crypto_letter" /></td> <td></td> <td><input name="exclam" type="text" class="crypto_letter" /></td> <td><input name="3" type="text" class="crypto_letter" /></td>
             </tr>
    
    </table>
    
    <input type="submit" value="Submit" />
    
    </form>

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,602
    Thanks
    78
    Thanked 4,387 Times in 4,352 Posts
    What's the definition of "got all the letters right"???? Guessed the meaning of each tile??

    But if your JS code can tell them that, then all anybody has to do is VIEW-->>SOURCE to see the HTML of the page and then they can get it perfect each and every time.

    So doing this all in JS is tantamount to giving away the answers.

    And how can anybody solve a 5-letter cryptogram except by wildly random luck?

  • #3
    New Coder
    Join Date
    Jan 2008
    Posts
    13
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Thanks for replying, Old Pedant.

    The five letters were just to serve as an abbreviated example. But to answer your first question, yes. I understand what you mean about the view source issue. Guess I hadn't thought that far ahead.

    Can you recommend another avenue to head down?

    Thanks,

    ransomcat

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,602
    Thanks
    78
    Thanked 4,387 Times in 4,352 Posts
    Use server-side code to do the scoring.

    PHP or ASP or JSP or whatever.

    You might still want to use JS to ensure that the person has indeed put *something* into each field, and maybe make sure it's a letter. But no more than that.


  •  

    Tags for this Thread

    Posting Permissions

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