Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
I need help with coding a Form
Old 05-26-2006, 11:22 PM I need help with coding a Form
Experienced Talker

Posts: 42
Trades: 0
I am new to writing HTML.

I have read HTML tuts, looked at examples and tried different things, but I'm stuck on how to make my Form do what I need it to do.

I have a simple Form that a user inputs information in and clicks a submit button.

When the information is submitted, it must match a specific line of text (which is always the same and is specified somewhere within the code of that same page).

If the submitted information does not match the specified line of text, then I need to present a message to the user to enter the correct information.

If the submitted information does match the specified line of text, then I want to send the user to another (specified) page within the site.

This is what I have so far;
<html>
<body>
<form name="input" action="html_form_action.asp"
method="get">
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">
Enter your answer and click Go
</p>
<form>
Answer:
<input type="text" name="answer">
<input type="submit" value="Go">
</form>

Question>>>If the answer is not correct, what do I need to put in here (???) to return a message like, "Please enter the correct answer"

Question>>>If the answer is correct, what do I need to put in here (???) to make it go to a specific address? - Such as;
Code:
<a href="http://www.website.com/address.html"></a">
</font>
</body>

</html>

Also, is this the correct type of form for what I am trying to do? <form name="input" action="html_form_action.asp"
method="get">

Can anyone help me by providing the code that I need to make this work?

Thank you,
Charles
CSUjr is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-27-2006, 01:49 PM Re: I need help with coding a Form
Experienced Talker

Posts: 42
Trades: 0
Okay, this is what I have now.

It doesn't work, but I think that it's closer;

<style type="text/css">
<!--
.style1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: small;
}
-->
</style>
</head>

<body>

<form name="input" action="html_form_action.asp" >
<p class="style1">
Enter your answer and click Go</p>


<span class="style1">Answer:</span>
<input type="text" name="answer">
<input type="submit" value="Go">

<% if request.form('answer')="correct answer"
<a href="success.html"></a>
<% else %>
<p class="style1">Please enter the correct answer</p>

<% end if %>
</form>
</body>
</html>

Can anyone please help me with the correct coding?
CSUjr is offline
Reply With Quote
View Public Profile
 
Old 05-27-2006, 01:57 PM Re: I need help with coding a Form
RNPoo7's Avatar
Extreme Talker

Posts: 238
Trades: 0
Post this in the page that will has the form:

Code:
<?php
  if(isset($_POST['submit']) && $_POST['submit'] == 'Submit') //if form has been submitted
  {
    //for now:
    
    //get all the data from the form
    $email = $_POST['EmailFrom'];
    $name= $_POST['Name'];
    $subject = $_POST['Subject'];
    $phone = $_POST['Phone'];
    $comment = stripslashes($_POST['Comments']);
    $sendTo = "You <youemail@service.com>"; //this will be the address that the mail gets sent to
    
    $errors = '';
    if($name == '')
    {
      $error .= "<span class=\"error\">You must enter your <label for=\"Name\">name</label>.</span><br>";
    }
    if($email == '')
    {
      $error .= "<span class=\"error\">You must enter an <label for=\"EmailFrom\">e-mail</label> address.</span><br>";
    }
    elseif(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$", $email)) //if email entered, verify format
    {
      $error .= "<span class=\"error\">Your <label for=\"EmailFrom\">email</label> is not of valid format.</span><br>";
    }
    if($subject == '')
    {
      $error .= "<span class=\"error\">You must enter a <label for=\"Subject\">subject.</label></span><br>";
    }
    if($comment == '')
    {
      $error .= "<span class=\"error\">You must enter some <label for=\"Comments\">comments</label>.</span><br>";
    }
    if($error == '') //If no errors
    {      
      $body = "You have received the following from the web based contact form:\r\n";
      $body .= "---------------------------------------------------------------\r\n";
      $body .= "Subject:    ".$subject."\r\n";
      $body .= "From:       ".$email."\r\n";
      $body .= "Name:        ".$name."\r\n";
      $body .= "Phone:        ".$phone."\r\n";
      $body .= "Questions/Comments:\r\n";
      $body .= $comment ."\r\n";
      $body .= "IP Address: ".$_SERVER['REMOTE_ADDR']."\r\n";
      $body .= "---------------------------------------------------------------\r\n";
      
      $headers = 'From: '.$email."\r\n" .
                 'Reply-To: '.$email;
                if(mail($sendTo, $subject, $body, $headers))
      {
        $success="<div class=\"error centertext\">Your email has been sent. We will respond back as soon as possible. Thanks for contacting us.</div>";
        $name='';
        $email='';
        $comment='';
      }
      else
      {
        $error = "<div class=\"error\"><span class=\"error\">Your email was NOT sent. Please make sure all forms have been filled out correctly.</span></div>";
        exit();
      }
    }
  }    
?>


           <?php
          if(!empty($error))
          {
            echo "<div class=\"error\">\n";
            echo "<h4>Error, please try again</h4>";
            echo $error;
            echo "</div>\n";
          }
          if(!empty($success))
          {
              echo $success;
          }
        ?>
Then After you write whatever you want like "if you want to contact us, use the form below or whatever you want"

Add the following:'

Code:
<form method="post" action="<?php echo $_SERVER['contact2.php']?>">
Fields marked (*) are required

<p><label for="EmailFrom">Your Email:*</label> <br>
<input type="text" name="EmailFrom" id="EmailFrom">
</p>
<p><label for="Name">Name:*</label><br>
<input type="text" name="Name" id="Name">
</p>
<p><label for="Subject">Subject:*</label><br>
<input type="text" name="Subject" id="Subject">
</p>
<p><label for="Phone">Phone:</label><br>

<input type="text" name="Phone" id="Phone">
</p>
<p><label for="Comments">Comments:*</label><br>
<textarea name="Comments" id="Comments" cols="50" rows="10"></textarea>
</p>
<p><input type="submit" name="submit" value="Submit">
<input type="reset" value="Reset"/>
</p>

</form>


Then you will need to make another file, which I have it named as "contact2.php"
If you use any other than "contact2.php", then you must change it in the 2nd part of the code above.

Finally, in the new page that you make (contact2.php)
you need to put the following:

Code:
<?php
          if(!empty($error))
          {
            echo "<div class=\"error\">\n";
            echo "<h4>Uh oh! An error occurred...</h4>";
            echo $error;
            echo "</div>\n";
          }
          if(!empty($success))
          {
              echo $success;
          }
        ?>

Don't forget to make sure both those pages are php pages and not html pages.
Also, don't forget to use a real email address in the 1st part instead of "youremail@service.com"

Hope this works for you.
__________________
I work on Turbo'd Honda's for fun :)

Last edited by RNPoo7; 05-27-2006 at 02:02 PM..
RNPoo7 is offline
Reply With Quote
View Public Profile
 
Old 05-27-2006, 05:26 PM Re: I need help with coding a Form
Experienced Talker

Posts: 42
Trades: 0
Thank you, but that is far more than I need and I don't think that it contains the code that I need to do this;
1. The User enters text into the Form
2. The User clicks the submit button
3. If the text does not match the text that is specified in the Form then, the User recieves a message, "Please enter the correct text"
4. If the text does match the text that is specified in the Form then, the User is sent to a Page that is specified in the Form.

The information that is in the Form is;
1. The correct text (for validation)
2. The name (address) of the page that the User is sent to (success.html) when they have entered the correct text.

If I am using the wrong Form (.asp or method=Get, etc) or if there is another way or Form (.php, etc.) that I can use to accomplish this, please let me know.

Anyone, please.
CSUjr is offline
Reply With Quote
View Public Profile
 
Old 05-27-2006, 06:02 PM Re: I need help with coding a Form
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
actually seeing as the code RNPoo7 posted is PHP and your form action says html_form_action.asp

I should pretty much ignore it

what you need is some ASP code
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?

Last edited by chrishirst; 05-27-2006 at 06:04 PM..
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-27-2006, 06:13 PM Re: I need help with coding a Form
RNPoo7's Avatar
Extreme Talker

Posts: 238
Trades: 0
I tried :shrugs:
__________________
I work on Turbo'd Honda's for fun :)
RNPoo7 is offline
Reply With Quote
View Public Profile
 
Old 05-27-2006, 06:18 PM Re: I need help with coding a Form
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Good code though. Would have worked apart from that minor detail
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-27-2006, 06:51 PM Re: I need help with coding a Form
Experienced Talker

Posts: 42
Trades: 0
chrishirst wrote:
Quote:
Good code though. Would have worked apart from that minor detail
Thank you.

You seem to know a lot about this sort of thing.

So, can you give me the code that I need to make a Form to do what I need it to do?

Or can anyone here do that?

Charles

Last edited by CSUjr; 05-27-2006 at 06:53 PM..
CSUjr is offline
Reply With Quote
View Public Profile
 
Old 05-27-2006, 11:28 PM Re: I need help with coding a Form
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,898
Name: Keith Marshall
Location: Connecticut
Trades: 0
I know nothing about asp - but courious as to your username, where does it come from?
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 05-28-2006, 02:45 AM Re: I need help with coding a Form
Experienced Talker

Posts: 42
Trades: 0
CSU are my initials, as were my Fathers, therefore I am a jr. My Grandson is CSU IV.

I hope that this satisfies your curiosity.

Also, I hope that this demonstrates my desire and willingness to help others here, the very best way that I can, regardless of how trivial the request may be.

Although this is true, I suppose that this is just a release of some frustration that I am experiencing from the responses to my request for a few lines of seemingly common, simple code.

I find it difficult to believe that there is no one here that possesses both the knowledge and ability to write the specific simple array of code that I need.

Is it that, I just do not know that perhaps there is some unwritten rule here regarding folks writing code for each other?

If not, is there anyone here that Can and Will help?

Charles
CSUjr is offline
Reply With Quote
View Public Profile
 
Old 05-28-2006, 03:32 AM Re: I need help with coding a Form
Experienced Talker

Posts: 42
Trades: 0
Okay, let me try again.

The code below sends the User to the desired page regardless of what is in the text box, and even if it is empty.

This means that I have not put the right information in the right place in this code.

I want it so that the User Must enter the correct information
if not, the User will receive a message such as; “Please enter the correct information”
if so, the User will be sent to the specified page

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Answer Validation</title>
<style type="text/css">
<!--
.style1 {
 font-family: Geneva, Arial, Helvetica, sans-serif;
 font-size: small;
}
-->
</style>
</head>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function validateForm()
{
var count=0;
var msg="correct";
    for(i=0;i<=4;i++)
    {
        if(document.UD.elements[i].value=="correct")
        {
        count=1;
        msg=msg+"\n"+document.UD.elements[i].name;
        }
        else if((i>3) && (count==0))
        {
            return(true);
        }
    }
    for(i=0;i<=4;i++)
    {
        if(document.UD.elements[i].value=="correct")
        {
        alert("Please enter Correct Answer\n "+msg);
        document.UD.elements[i].focus();
        return(false);
        }
    }
 
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<FORM METHOD=POST ACTION="success.html" NAME="UD">
<TABLE ALIGN="CENTER">
<TR>
    <TD><span class="style1">Enter Correct Answer </span></TD>
    <TD><INPUT NAME="correct" TYPE="TEXT" size="40"></TD><TD><INPUT TYPE="SUBMIT" VALUE="Go"
    onClick="return validateForm()"></TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
Will someone please help me make this so that it works the way that I need it to?

Charles
CSUjr is offline
Reply With Quote
View Public Profile
 
Old 05-28-2006, 04:56 AM Re: I need help with coding a Form
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
this is the HTML forum and your code required is ASP. I have flagged the thread to be moved.


put this code above the document head and change the form method to "post" and action to be "" so it will submit to itself.

Code:
<%
dim correct_answer, message
correct_answer = "put answer here"
if request.form"("submit") <> "" then
if request.form("answer" = correct_answer then 
   response.redirect("correct_answer_page.ext")
else
   message = "Text to show the input was incorrect"
end if
%>
then add this to your form
Code:
<%=message%>
<form ....>

bit more of a compex example at http://www.candsdesign.co.uk/article...logon/demo.asp
click the "Show Code" link to get the code for it
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-28-2006, 06:25 AM Re: I need help with coding a Form
Experienced Talker

Posts: 42
Trades: 0
Okay, I tried to do exactly what you said, but it doesn’t work.

This is what I did according to my best understanding of your directions;
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Code:
<html xmlns="http://www.w3.org/1999/xhtml">
<%
dim correct_answer, message
correct_answer = "put answer here"
if request.form"("submit") <> "" then
if request.form("answer" = correct_answer then 
response.redirect("correct_answer_page.ext")
else
message = "Text to show the input was incorrect"
end if
%>
 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<BODY>
<FORM METHOD=POST ACTION="" NAME="UD">
<TABLE ALIGN="CENTER">
<TR>
 <TD><span class="style1">Enter Correct Answer </span></TD>
 <TD><INPUT NAME="correct" TYPE="TEXT" size="40"></TD><TD><INPUT TYPE="SUBMIT" VALUE="Go"
 onClick="return validateForm()"></TD>
</TR>
</TABLE>
<%=message%>
<form ....>
 
</FORM>
</BODY>
</HTML>
I am not experienced in writing code that is why I asked for someone to write the code so I can just paste it in as they wrote it.

Instead of giving me directions that I don’t understand, can you take what I have and just rewrite it so that it will work?
CSUjr is offline
Reply With Quote
View Public Profile
 
Old 05-28-2006, 07:04 AM Re: I need help with coding a Form
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
By the look of what you are doing you need to go back and read your tutorials without skipping any parts this time.

You are using a XHTML doctype and have uppercase tags. XHTML should be all lowercase

Code:
<%
dim correct_answer, message
correct_answer = "put answer here"
message = "Enter your answer"
if request.form"("submit") <> "" then
if request.form("answer" = correct_answer then 
response.redirect("correct_answer_page.ext")
else
message = "Text to show the input was incorrect"
end if
%>
 
<!-- doctype goes in here -->
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<BODY>
<%=message%>
<FORM METHOD=POST ACTION="" NAME="UD">
<TABLE ALIGN="CENTER">
<TR>
 <TD><span class="style1"><%=message%></span></TD>
 <TD><INPUT NAME="answer" TYPE="TEXT" size="40"></TD>
<TD>
<INPUT TYPE="SUBMIT" VALUE="Go" name="submit"></TD>
</TR>
</TABLE>
</BODY>
</HTML>
can't make it much simpler without being very patronising

MAKE SURE YOU SAVE THIS PAGE WITH A ASP EXTENSION.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-28-2006, 11:16 AM Re: I need help with coding a Form
Experienced Talker

Posts: 42
Trades: 0
Okay, I changed all of the CAPS to lower case, I inserted the DOC TYPE where you said and I believe that it was saved as an ASP - but it still doesn't work.

What am I doing wrong or not doing right?

This is what I have now;
Code:
<%
dim correct_answer, message
correct_answer = "put answer here"
message = "Enter your answer"
if request.form"("submit") <> "" then
if request.form("answer" = correct_answer then 
response.redirect("001home.html")
else
message = "Text to show the input was incorrect"
end if
%>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {font-family: Verdana, Arial, Helvetica, sans-serif}
.style2 {font-size: x-small}
.style3 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; }
-->
</style>
</head>
<body>
<%=message%>
<form method=post action="" name="UD">
<tr>
 <td><div align="center"><span class="style1"><%=message%><span class="style2">Enter answer and click Go </span></span></div></td>
 <td><div align="center"><span class="style3">Answer: 
     </span>
   <input name="answer" type="text" size="40">
   <input type="submit" value="Go" name="submit" />
 </div></td>
<td><div align="center"></div></td>
</tr>
</form>
</body>
</html>
Can you just write this so that it will do what I need it to do?

Thanks,
Charles
CSUjr is offline
Reply With Quote
View Public Profile
 
Old 05-28-2006, 11:20 AM Re: I need help with coding a Form
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
define "doesn't work"

what doesn't it do?
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-28-2006, 11:29 AM Re: I need help with coding a Form
Experienced Talker

Posts: 42
Trades: 0
I first saved it as answer.asp
I uploaded it (via WS_FTP Pro) to my website and went to the page and it said that the page could not be displayed.

I then saved it as answer.html and I uploaded it (via WS_FTP Pro) to my website and went to the page.

The page opened and it was layed out correctly but when I clicked "Go" it said that the page can not be displayed.
CSUjr is offline
Reply With Quote
View Public Profile
 
Old 05-28-2006, 12:53 PM Re: I need help with coding a Form
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Code:
<%
dim correct_answer, message
correct_answer = "put answer here"
message = "Enter your answer and click Go"
if request.form("submit") <> "" then
if request.form("answer") = correct_answer then 
response.redirect("001home.html")
else
message = "Text to show the input was incorrect"
end if
end if
%>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {font-family: Verdana, Arial, Helvetica, sans-serif}
.style2 {font-size: x-small}
.style3 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; }
-->
</style>
</head>
<body>
<form method=post action="" name="UD">
<tr>
 <td><div align="center"><span class="style1"><%=message%></span></div></td>
 <td><div align="center"><span class="style3">Answer: 
     </span>
   <input name="answer" type="text" size="40">
   <input type="submit" value="Go" name="submit" />
 </div></td>
<td><div align="center"></div></td>
</tr>
</form>
</body>
</html>

typos and missing quotes corrected

you need to show the full error message in your browser to see what is going wrong then you can fix it.

For IE

Tools -> Internet Options -> Advance tab -> scroll down and Uncheck show friendly error messages
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-28-2006, 03:23 PM Re: I need help with coding a Form
Experienced Talker

Posts: 42
Trades: 0
christhirst wrote:
Quote:
<%
dim correct_answer, message
correct_answer = "put answer here"
message = "Enter your answer and click Go"
if request.form("submit") <> "" then
if request.form("answer") = correct_answer then
response.redirect("001home.html")
else
message = "Text to show the input was incorrect"
end if
end if
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {font-family: Verdana, Arial, Helvetica, sans-serif}
.style2 {font-size: x-small}
.style3 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; }
-->
</style>

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-139461-1";
urchinTracker();
</script>
</head>
<body>
<form method=post action="" name="UD">
<tr>
<td><div align="center"><span class="style1"><%=message%></span></div></td>
<td><div align="center"><span class="style3">Answer:
</span>
<input name="answer" type="text" size="40">
<input type="submit" value="Go" name="submit" />
</div></td>
<td><div align="center"></div></td>
</tr>
</form>
<br /><div style="z-index:3" class="smallfont" align="center">Content Relevant URLs by vBSEO 2.4.0 &copy; 2005, Crawlability, Inc.</div></body>
</html>


typos and missing quotes corrected

you need to show the full error message in your browser to see what is going wrong then you can fix it.

For IE

Tools -> Internet Options -> Advance tab -> scroll down and Uncheck show friendly error messages
The first thing that I did was,
I went to IE, Tools -> Internet Options -> Advance tab -> scrolled down and Unchecked the show friendly error messages box.- - as you said to do.

I then opened my Dreamweaver 8 program, created a new page and saved it.

I then pasted in the code, exactly as shown, and saved the page again.

I went to my WS_FTP Pro and uploaded that page to my web site (which supports ASP).

I closed everything out, reopened IE (IE 6), entered that page into the address window of my browser and clicked Go>.

The page came up but again, when I typed in both the correct and incorrect answer, it said "Page cannot be displayed".

I don't why.

I don't know if this will help any but, as I mentioned before, the code below DOES go to the desired page when "Go" is clicked.

But, it goes to that page regardless of what, if anything, is typed into the text validation form.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Answer Validation</title>
<style type="text/css">
<!--
.style1 {
 font-family: Geneva, Arial, Helvetica, sans-serif;
 font-size: small;
}
-->
</style>
</head>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function validateForm()
{
var count=0;
var msg="correct";
    for(i=0;i<=4;i++)
    {
        if(document.UD.elements[i].value=="correct")
        {
        count=1;
        msg=msg+"\n"+document.UD.elements[i].name;
        }
        else if((i>3) && (count==0))
        {
            return(true);
        }
    }
    for(i=0;i<=4;i++)
    {
        if(document.UD.elements[i].value=="correct")
        {
        alert("Please enter Correct Answer\n "+msg);
        document.UD.elements[i].focus();
        return(false);
        }
    }
 
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<FORM METHOD=POST ACTION="001home.html" NAME="UD">
<TABLE ALIGN="CENTER">
<TR>
    <TD><span class="style1">Enter Correct Answer </span></TD>
    <TD><INPUT NAME="correct" TYPE="TEXT" size="40"></TD><TD><INPUT TYPE="SUBMIT" VALUE="Go"
    onClick="return validateForm()"></TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
I guess that I was wrong thinking that this is just a very common, simple Form that I just did not understand.

I see this done (for other operations) in almost every web site that I visit.

I have viewed the source code in many of these sites and see that nearly all of them are done somewhat differently - but they all work.

How come this particular Form is so difficult to get to work?

Charles
CSUjr is offline
Reply With Quote
View Public Profile
 
Old 05-28-2006, 03:28 PM Re: I need help with coding a Form
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
<FORM METHOD=POST ACTION="001home.html" NAME="UD">

this line is probably the one causing the problem !!!!!

does THIS page exist !!!

what's the url of the page ?
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?

Last edited by chrishirst; 05-28-2006 at 03:29 PM..
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to I need help with coding a Form
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.84082 seconds with 12 queries