?
Solved

HTML Code help

Posted on 2013-05-09
12
Medium Priority
?
355 Views
Last Modified: 2013-12-24
I need to have a line in my code that requires a response and I want that response to be the answer to a question before the user can "submit" a form to the owner of the questionare.

Example: what is the sum of 6 + 3? It should be a required field and the answer has to be 9 before the user can successfully hit the "submit" button to send the form.

Below is what I have so far

Thanks for your help

</select>&nbsp; <strong>*What is the sum of 6 + 3?:</strong>

<!--webbot bot="Validation" b-value-required="TRUE" --><input type="text" name="Answer" size="7"><p>&nbsp;</p>

<div align="center"><center><p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
0
Comment
Question by:dashman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
12 Comments
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39154567
You could user javascript to do that validation.  I don't know what the 'webbot' code does.  But I must tell you that most spammers will skip your form and submit spam directly to your action page.  You must also validate input on your action page to keep spam out.

What does that mean?  If I look at the "View Source" of your page, I can read the action="xx.php" address you are sending the info to.  Then I can simply make up a form on my computer that submits info directly to that page without going thru your form.
0
 

Author Comment

by:dashman
ID: 39155113
I appreciate your response. I am trying to help out a friend with his website. Someone else originally wrote the javascript code. I am familiar with html but not javascript. I understand what you are saying about making up a form but that is not what the bot is doing. I need to have a field that they have to answer correctly. I have looked at some Captcha sites but cannot seem to get any to work. I was hoping for something a little easier but I guess that might be hard to find.

I did look at the form page source and found this line of code. He is using Frontpage (I know that is outdated but we had been able to make all the changes we needed with it) and see that if we could make it read "does not equal 9 then return false" that would do it.. When I look at the html code in Frontpage I do not see the javascript code so I do not know how you access that to change it.

if (theForm.Answer.value == "")
  {
    alert("Please enter a value for the \"Answer\" field.");
    theForm.Answer.focus();
    return (false);
0
 
LVL 82

Expert Comment

by:leakim971
ID: 39155696
please provide a link to see the page
0
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
LVL 82

Expert Comment

by:leakim971
ID: 39155811
http://www.neusob.de/projekt/workshop/webbot.htm

I think you need help from an other zone :
http://www.experts-exchange.com/Web_Development/Software/FrontPage/

Try to change the zone of your question or request attention of a moderator (there's a link somewhere in this page)
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39156190
As it says in the "View Source" of your page, the javascript is generated by Frontpage and is not directly editable in Frontpage.
0
 

Author Comment

by:dashman
ID: 39156512
then how do you edit the javascipt and how would you change it to make it a set value? I think you can see that I am a novice at this aspect (been an IT consultant for 20 years) and could use all the help I can get.

Thanks
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39156571
You would have to stop using Frontpage and do the editing manually.  Wait and see if anyone from the Frontpage zone has another suggestion.
0
 
LVL 53

Accepted Solution

by:
Scott Fell,  EE MVE earned 2000 total points
ID: 39157607
You could use http://www.google.com/recaptcha/captcha

However, I do the same thing you are doing for smaller sites.   I would not use js unless you are using to post to another page (ajax) where that page is testing serverside. Otherwise, the way this works is you create your answer serverside before the page loads and store the answer in a session.  Then allow t he form to post and test for the answer and if the answer is not correct, send them back to the form.  To make it easy for your user, save the form answers and write them back to the form fields so they don't have to type them in again.  I also keep a counter in a session and after the counter goes past a number like 3 or 4, make them start over or prevent the page from loading.  Of course when the session resets or they close their browser they can try again.  

Here it is quickly in asp since you are using front page
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
' --- this function makes a random number 1 to 10
function rNumber()
max=10
min=1
Randomize
rNumber=(Int((max-min+1)*Rnd+min))
end function

x=rNumber ' the function makes the first number
y=rNumber ' the function makes the 2nd number
question="what is "&x&" + "&y
session("answer")=x+y

%>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Request an Appointment</title>
</head>
<!-- your code -->
<form>
<!-- your form code -->
  </select>&nbsp; <strong>To assure that a human is filling out this form please answer the following question:</strong>
  </select>&nbsp; 
<!--  ****** your new question code **** -->
<strong>*<%=question%></strong>
<!--  ****** end your new question code **** -->
  <!--webbot bot="Validation" b-value-required="TRUE" --><input type="text" name="Are_you_a_human" size="7"></p>

</form>
<body>

Open in new window

Then on the page where you process your code at the top of the page
<%
if cstr(request.form("Are_you_a_human"))<>cstr(session("answer")) then
     response.redirect("appointment.htm")
end if

%>

Open in new window

You can do this just as easy in php or any serverside language.  If you want to keep the page as html, then you would put the server side code on a separate asp page and use ajax to call the info.
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
The purpose of this video is to demonstrate how to prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question