Click to See Complete Forum and Search --> : Forms Submit Question....


cis
01-31-2003, 03:41 PM
I'm well versed in HTML but am a relative newbie to web design. I have done some java and a little ASP programming, but have not retained much of it as it was several years ago.

I'm putting together a series of protected HTML pages that a person must agree to a contract ("I agree") before entering. For our own purposes, I want to insert two mandatory fields called "Name" and "Name of Business or Organization" before they can "Agree." I would like to then have this information emailed to me every time someone agrees to the contract.

I have built something ages ago that, using Java, said
" Name field" must be filed in, before they are allowed to progress.

I have zero recollection of how to do "submit" buttons, etc and code. If it isn't too hard or too much of a hassle can someone quickly go over the scripts and code required to allow me to do this. The site is my own little deal and I can't afford to pay someone to help me out on it...

Thanks and I really appreciate it!

swon
01-31-2003, 04:32 PM
Do you need something like that?

--------------------------------------------------------------
<html>
<head>
<title></title>
<meta name="author" content="swon">
<meta name="generator" content="Ulli Meybohms HTML EDITOR">
<script language="JavaScript">
<!--
function checks(){
x = document.MyForm.Name.value;
y = document.MyForm.Name_of_Business_Organization.value;
if(y != "" && x!="")
{document.MyForm.agree.disabled = false;}
else{document.MyForm.agree.disabled = true;document.MyForm.agree.checked = false;
return false;}
}
function checking(form){

if(form.agree.checked == true)
{document.MyForm.submit();}
else{return false;}
}
//-->
</script>
</head>
<body>
<form name=MyForm onSubmit="return checking(this)" action="mailto:yours@yourdomain.com" enctype="text/plain" method="post" >
<table border="0">
<tr>
<td>Name:</td><td><input type="text" name="Name" onChange=checks()></td>
</tr>
<tr>
<td>Name of Business or Organization:</td><td><input type="text" name="Name_of_Business_Organization" onChange=checks()></td>
</tr>
<tr>
<td>Yes, I agree:</td><td><input type="checkbox" name="agree" value="yes" disabled></td>
</tr>
<tr>
<td></td><td><input type="Submit" value="Submit"><input type="reset"></td>
</tr>
</table>
</form>
</body>
</html>
----------------------------------------------------------------------

cis
01-31-2003, 04:38 PM
MUCH MUCHJ APPRECIATED!!!

I'll try it out and see how it works. Also, how do I get it so when it submits, it serves as a link to a new page a well?

swon
01-31-2003, 04:44 PM
As a link with the variables and their values? without or with submitting the form via email?

cis
01-31-2003, 04:46 PM
click submit= send email and redirect to a new page in the same function.

swon
01-31-2003, 04:52 PM
Ok, replace the script with this one:

<script language="JavaScript">
<!--
function checks(){

NewPage = "http://www.google.com";//enter the redirect page

x = document.MyForm.Name.value;
y = document.MyForm.Name_of_Business_Organization.value;
if(y != "" && x!="")
{document.MyForm.agree.disabled = false;}
else{document.MyForm.agree.disabled = true;document.MyForm.agree.checked = false;
return false;}
}
function checking(form){

if(form.agree.checked == true)
{document.MyForm.submit();
form.agree.checked == false;
window.location.href= NewPage;}
else{return false;}
}
//-->
</script>

cis
01-31-2003, 04:57 PM
THanks!!!!

cis
01-31-2003, 05:07 PM
Swan or others, is it possible to send the email so they wouldn't know it (to not rely on Outlook or making sure that the user has their default email settings in tact). How would I implement this?

I would prefer it if they click submit and using a pop address (or some other function, it sent perhaps an anonymous email using a CGI script or something (I did this once, long ago), that simply shoots an email from the page or server? Is this possible with the Java script and if so, how is it done...? I also believe you need to access a publically available cgi script somewhere, with pop server info imbedded into the doc too. I'm not aware of any now but could possibly find one I think. Do you think you could configure a script that could help me implement this?

swon
01-31-2003, 05:09 PM
Well, as you said, you have to use a server-side-language for such an application, does your server supports PHP?

cis
01-31-2003, 05:16 PM
Not in it's current configuration. I will have to pay dearly to the hosting company to do modify it for such and I don't know jack about php scripting either. However, I did build an email form once that when you clicked "submit" it send out a crude email with the data (what I'm looking to have done), but the CGI script I used (I was in college at the time) was a publically available CGI, using a http reference I believe. So I would like to do that... I am imagining the field verification from the Java you just wrote and the email function are two totally different functions. I'll start looking for that CGI, and will post it. Give me 5 minutes. Otherwise, any ideas, think this will work without PHP?

cis
01-31-2003, 05:33 PM
I'm surfing around and found this page:

http://cgi.resourceindex.com/Documentation/

With lots of available scripts. My server CAN run cgis that email with no problems in it's current configuration...

swon
01-31-2003, 05:37 PM
If you found some, change only the action in the <form> and set it to the cgi-script, for example mail.cgi!

cis
01-31-2003, 05:39 PM
Great, thanks! If I have trouble I might be back!

swon
01-31-2003, 05:45 PM
Ok ;-)