FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Code Stops Working
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Code Stops Working [message #172464 is a reply to message #172395] Sat, 19 February 2011 18:46 Go to previous messageGo to previous message
mrc2323 is currently offline  mrc2323
Messages: 12
Registered: February 2011
Karma:
Junior Member
In article <4d5bd187$0$7839$bed64819(at)gradwell(dot)net>,
denis(dot)m(dot)f(dot)mcmahon(at)googlemail(dot)com says...
> I reduced your php code to a minimal example, and then made it work:
>
> ----8<----8<----8<-- cut here --8<----8<----8<----
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
> "http://www.w3.org/TR/html4/strict.dtd">
>
> <html>
> <head>
> <meta http-equiv="Content-Type"
> content="text/html; charset=utf-8">
> <meta name="MSSmartTagsPreventParsing" content="TRUE">
> <title>Form Test</title>
> <!-- provide trim() and
> notifyInvalidInput() functions -->
> <!-- re-written checkInput() function -->
> <script type="text/javascript">
> function checkInput() {
> var runner = document.getElementById("runner");
> if (trim(runner.value) == "") {
> notifyInvalidInput("Name is a required field. "+
> "Please enter your name.", runner);
> return false;

Denis, I really appreciate your sample here - it works nicely for
what you did for me. I have a couple of problems, though:
Your rewrite of the "checkInput" function works only for the "runner"
field and doesn't seem extensible for others I need. And the invocation
of the function is part of the "action=" code. So it seems that the
only field that can be checked is that one (runner), even when I extend
your template to all the fields I need to input and process.
Am I missing something in this?

<p>Basic Form:</p>
<form name="ques_form" id="ques_form"
action="<?php echo $_SERVER['PHP_SELF'] ?>"
method="post" onsubmit="return checkInput();">
<table>
<tr><td>Name: </td><td><input type="text"
name="runner" id="runner" size="30"></td></tr>
<tr><td colspan="2" align="center">
<input type="submit" name="submit" id="submit">
</td></tr>
</table>
</form>

Also, I checked my ISP regarding the"register_globals" option: it's
set "off". So I guess that whatever's causing my problems with the code
that used to work, but now isn't, is not that particular issue.
I'm pursuing expanding your template to add other fields (hence this
message), but it's difficult for me as a PHP newbie...as well as having
to work with this "production site" in times where it isn't likely to be
used. 8<}}
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: about memory usage with php application
Next Topic: PHP currency converter with XML feed
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 23:25:04 GMT 2024

Total time taken to generate the page: 0.04391 seconds