Solved

clear form field

Posted on 2015-01-14
2
80 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
Comment Utility
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
Comment Utility
You made that look easy!.
Great solution.
Cheers,
Neil
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article will show, step by step, how to integrate R code into a R Sweave document
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

762 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

9 Experts available now in Live!

Get 1:1 Help Now