Solved

clear form field

Posted on 2015-01-14
2
83 Views
Last Modified: 2015-01-14
Hi All,
please see the following code snipet
/ hides the return date field
 function showhidefield()
  {
    if (document.frm.isOneWay.checked)
    {
      document.getElementById("hideablearea").style.visibility = "hidden";
	  document.getElementById("returnLabel").style.visibility = "hidden";
    }
    else
    {
      document.getElementById("hideablearea").style.visibility = "visible";
	  document.getElementById("returnLabel").style.visibility = "visible";
    }
  }

Open in new window


The code hides a form field wrapped in a div (#hideablearea) when a checkbox is checked.
I would also like to delete the contents of the form field in my div as well as hide it.
Can my code be updated to perform both actions?

The id of the form field is #RDate if that helps.
Cheers,
N
0
Comment
Question by:Neil_Bradley
2 Comments
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 500 total points
ID: 40549639
Hi,
this should do the trick:
/ hides the return date field
 function showhidefield()
  {
    if (document.frm.isOneWay.checked)
    {
      document.getElementById("hideablearea").style.visibility = "hidden";
	  document.getElementById("returnLabel").style.visibility = "hidden";
document.getElementById("RDate").value = '';
    }
    else
    {
      document.getElementById("hideablearea").style.visibility = "visible";
	  document.getElementById("returnLabel").style.visibility = "visible";
    }
  }

Open in new window

HTH
Rainer
0
 
LVL 5

Author Closing Comment

by:Neil_Bradley
ID: 40549891
You made that look easy!.
Great solution.
Cheers,
Neil
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

778 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