Solved

clear form field

Posted on 2015-01-14
2
81 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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
This article will show, step by step, how to integrate R code into a R Sweave document
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

863 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now