I took a similar approach, and didn't find the html + rev too akward ... here's what I have


      -- the next section is the HTML form
-- with rev snippets to fill in the default data or data already supplied
      put round(random(8)) into t1
      put round(random(8)) into t2
      put t1+t2 into tTotal
?>

   Please enter the following data:

<form method="post" action="<?rev put pPage ?>">
<-- all the html for the other fields -->
<p><label for="total">Please supply the total of <?rev put t1 & " + " & t2 ?>:</label> <input type="text" name="total" size="20" maxlength="20" value="" /> <br /> <p> <input type="hidden" name="thetotal" value="<?rev put tTotal ?>" /> <br />

and elsewhere when I get input, I have simply

      put $_POST["total"] into tTotal
      put $_POST["thetotal"] into tTheTotal

      -- check that enough valid data has been received
      -- the error message could be more detailed here

      if tTotal <> tTheTotal then
put "<b><div color='red'>Please get the sum right.</div></b>" into tErrorMessage
      else
         -- data ok, so set the flag
         put true into tDataEnteredOK
      end if

-- Alex.
On 10/03/2011 08:19, Medard wrote:
stephen barncard<stephenrevoluti...@barncard.com>  wrote:

you might do what Sarah did: create a simple handler to create, randomize
and ask a math problem to enter:
I took eventually this solution :-)
It was a little awkward to manage the mix of html and on-rev code, but I
made it work -- not a very polished code, but it works, and (I hope) I
am getting rid of that spam :-))

Anyway, Thanks to Sarah "Troz"!




_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to