View Full Version : Form problems

03-13-2005, 03:11 PM
Hi all,

I've got a bit of a problem with a form.. I'm sure you can do it better in PHP, but meh.. I don't know PHP :P

Basically, it's a form for a page with many downloads. I want people to tick a tickbox and type "I Agree" before they click a button to download. Preferably, I would like the text and ticked box to stay there so they can then proceed to download each file.

The problem I'm having is that I can only specify one form action (which in this case would be the program name) for the form, not for each individual button.

Layout of site:

-Index page

And the Index links to them.
Link (http://www.arbital24.com/Agreedownload/agreebox.htm) to a page to show you what I mean
Link (http://www.arbital24.com/Agreedownload/) to the folder


<script language='javascript' type="text/javascript">

function Validate() {
if (document.Accept.agreeT.value == "I Agree") {

if (document.Accept.agree.checked == true) {
return true;
} else {
alert ("You must tick the box to confirm your acceptance to the TOS for downloading Arby's VB programs!");
return false;

} else {
alert ("You must to type I Agree into the text box confirm your acceptance to the TOS for downloading Arby's VB programs!");
return false;


By typing "I Agree" into the text box and ticking the selection box, and hitting a download button, you are accepting blbh bakh

<form method="post" name='Accept' onsubmit='return Validate()'>
<input type='text' size='8' maxlength='7' value='' name='agreeT' class='forminput' /></td>
<input type='checkbox' name='agree' value='1' />

<p>download blah: </p> <input type="submit" value="Download blah" class='forminput' >
<p>Download Blah2:</p> <input type="submit" value="Download blah" class='forminput'>
<p>Download Blah3:</p> <input type="submit" value="Download blah" class='forminput'>


So basically yeah.. I need to be able to somehow make the "form action" dynamic or something, so that when they click on each of the links, it runs the check to make sure there's an "I agree" entry in the text box, and a ticked box, and then initiates the download.

I will be much appreciative of any help :)

Thanks a lot :)

On the advice from another forum:

okay so y not use an input type=button instead then onclick call validate() and if true then download the file that is to be downloaded

I changed to and added as so:

Okay.. but how do I make it download the file only if true? Can you provide a sample of code if possible ^_^

Thanks :)

EDIT: Currently I have:

<p>download blah: </p> <input type="button" onclick='return Validate()' value="Download blah" class='forminput'>

So, how do I set it to download only if true, and specify the filename?

So yeah.. It's still not working and no-one else is replying there.. Maybe someone here can help? ^__^