[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

HTML Code help

Posted on 2013-05-09
12
Medium Priority
?
361 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
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

 
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 54

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

Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

Question has a verified solution.

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

This article discusses how to implement server side field validation and display customized error messages to the client.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Suggested Courses

656 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