Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-14-2009, 06:41 PM   PM User | #1
ransomcat
New Coder

 
Join Date: Jan 2008
Posts: 13
Thanks: 2
Thanked 0 Times in 0 Posts
ransomcat is an unknown quantity at this point
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>
ransomcat is offline   Reply With Quote
Old 08-14-2009, 08:18 PM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,200
Thanks: 59
Thanked 3,996 Times in 3,965 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
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?
Old Pedant is offline   Reply With Quote
Old 08-14-2009, 08:56 PM   PM User | #3
ransomcat
New Coder

 
Join Date: Jan 2008
Posts: 13
Thanks: 2
Thanked 0 Times in 0 Posts
ransomcat is an unknown quantity at this point
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
ransomcat is offline   Reply With Quote
Old 08-14-2009, 09:47 PM   PM User | #4
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,200
Thanks: 59
Thanked 3,996 Times in 3,965 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
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.
Old Pedant is offline   Reply With Quote
Reply

Bookmarks

Tags
cryptogram, form validation, javascript, validation

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:53 AM.


Advertisement
Log in to turn off these ads.