Flash Games
 FAQ   Search   Memberlist   Usergroups   Register  Profile   Log in to check your private messages   Log in 


Help with putting this form together



 

Post new topic   Reply to topic  
   DEVPPL Forum Index -> HTML Forum
View previous topic :: View next topic  
Author Message
dodge-i



Joined: 31 May 2008
Posts: 1

PostPosted: Sat May 31, 2008 6:42 pm    Post subject: Help with putting this form together Reply with quote

I have this form and on it is a check box. The check
box will need to be check before the user can continue
on to the next page.

The submit button has an onclick event handler that will
run a javascript that will check to see if the check box
is checked. If it is not checked, a msg saying please
check the check box will be displayed next to the check
box.

I need help in setting up how I can run the javascript and
then submit the page to the server. Only when the checkbox
is checked will the submit button send data to the server. If
the check box is not checked and the user clicks submit, then
the javascript will be executed and no data will be sent yet.
Back to top
View user's profile Send private message
rangana
500+ Club


Joined: 27 Feb 2008
Posts: 718
Location: Cebu City Philippines

PostPosted: Mon Jun 02, 2008 4:07 am    Post subject: Re: Help with putting this form together Reply with quote

See if this basic example helps:
Code:

<script type="text/javascript">
function check()
{
   var check1=document.getElementById('check1'),
   check2=document.getElementById('check2'),
   message=document.getElementById('message');
   if(check1.checked!=true&&check2.checked!=true)
   {
   message.innerHTML='"My Message when checkboxes are not checked"';
   return false;}
   else return true;
}
</script>
<form name="#" action="http://www.google.com" onsubmit="return check()">
<input type="checkbox" id="check1"><label>Checkbox 1</label>
<input type="checkbox" id="check2"><label>Checkbox 1</label>
<span id="message"></span><br>
<input type="Submit" value="Submit">
</form>
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    DEVPPL Forum Index -> HTML Forum All times are GMT + 1 Hour
Page 1 of 1

 
 
Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User: Pass:
Log me on automatically each visit:

 


Powered by phpBB © 2001, 2005 phpBB Group - Modified by DEVPPL

Flash Games - Sitemap