473,395 Members | 1,442 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Clear form button to call java onclick function...

57
Ok, another query....

I have a checkbox at the bottom of my form which when checked unhides a <div> block which displays the submit button.

The problem I have is when the clear form button is pressed it removes the check but does not re-hide the submit <div> bit.

The way i see it, I have 3 options:
1) To simply remove the clear for button.
2) To exclude the said checkbox from the CLEAR button function.
3) To have the CLEAR button run an onlick to call the function which hides the submit button.

The latter would be my prefered. It sort of works in that the first click of the clear button clears the form, the second click calls the javascript which hides the <div> section.

This is the function which toggles the display:
Expand|Select|Wrap|Line Numbers
  1. <script> 
  2.             function toggle_display() { 
  3.                 var form   = document.getElementById('hidesubmit'); 
  4.                 var submit = document.getElementById('submit_group'); 
  5.                 ((form.checked)? submit.style.display='block': submit.style.display='none');
  6.                 }
  7. </script>
This is the lower part of the form which has the clear button in....

[HTML]<div id="submit_group" style="display:none;">
<table border="0" width="70%" id="table22" bgcolor="#CCFFFF">
<tr>
<td>
<p align="center"><font size="2">You may now click the SUBMIT button to
submit your e-Enrolment.</font><p align="center"><font size="2">When you click SUBMIT a screen will pop up indicating a program is sending an Email on your behalf.<br>
<b>You must click YES to submit the form.</b></font></td>
</tr>
</table>
<p>


<input type="Submit" value="Submit!">

</p>
</div>


<textarea rows="7" name="Authority" cols="30" style="width:753; font-weight:bold; height:116; font-family:Arial" wrap=virtual>ACCESS AUTHORISATION
I will tick the box to agree.....
</textarea><br>
<input type="checkbox" name="agreecheck" id="hidesubmit" value="Agreed" onClick="toggle_display();"/>
By placing a check in the box you are agreeing to the above Access Authorisation Statement.</font></b></p>
<input type="reset" onClick="toggle_display();" value="Clear Form"/>
<input type="hidden" name="EOR" value="">
</form>[/HTML]

Can I throw this open to suggests/comments...

Regards
Sep 4 '07 #1
5 5771
acoder
16,027 Expert Mod 8TB
Moved from Articles to forum section where the question is more likely to be answered.
Sep 4 '07 #2
plumba
57
Moved from Articles to forum section where the question is more likely to be answered.
Thanks acoder - I always make that mistake!!
Sep 4 '07 #3
epots9
1,351 Expert 1GB
does it work or does it give you an error message?
Sep 4 '07 #4
plumba
57
does it work or does it give you an error message?
No I get no error messages, it just makes me click it twice....
Sep 6 '07 #5
acoder
16,027 Expert Mod 8TB
I think I know what is happening. You are using a reset button which is running the toggling code and then resetting the checkbox so the div is not hidden. One possible solution is to call reset() first.
Sep 6 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Matt | last post by:
i need to implement a clear button to clear all the fields in the form, but i am thinking i can just use reset button. <input type="reset" name="reset" value="CLEAR"> The first thought is...
10
by: Steve Benson | last post by:
Our regular programmer moved on. I'm almost clueless in Javascript/ASP and got the job of adapting existing code. In the page below, everything works until I added the function checkIt() to...
7
by: | last post by:
I am having trouble figuring out to call a database INSERT procedure from a simple submit form. It appears I should use the onclick event to trigger the procedure called BUT when I do this I...
4
by: JP | last post by:
Hi folks, Using ASP and/or JavaScript, how do you create that little notification message (usually in red below the submit button) when the Submit button is pushed. Something that says "Your...
32
by: Don Lancaster | last post by:
In an existing, tested and working program, I have a form entry that simplifies to... <INPUT name ="fp1s" type="text" value=0.000 size=12 > and a button of... <input type="button" value="...
15
by: webstormcomputers | last post by:
I'm trying to update a hidden field with java script and I'm only getting one of the values from my select stament. Here is the code below. <select name="on0"> <option value="25">25 <option...
2
by: lintas | last post by:
Hi All, I am using a java script function for opening a pop up window in a link button click. And I am able to call the function at link button's second click only. I am not able to call the...
17
by: DeZZar | last post by:
Hi all, I need to regularly backup my database as an Excel file and have been using the File Export option. Problem is I need anyone using the database to be able to do this easily - nopt...
13
by: Andrew Falanga | last post by:
HI, Just a warning, I'm a javascript neophyte. I'm writing a function to validate the contents of a form on a web page I'm developing. Since I'm a neophyte, this function is quite simple at...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.