Solved

clear form field

Posted on 2015-01-14
2
88 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Interactive Way of Training for the AWS CSA Exam

An interactive way of learning that will help you visualize core concepts so that you can be more effective when taking your AWS certification exam.  Built for students by a student to help them understand the concepts that they are being taught.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to count occurrences of each item in an array.
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.

627 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