Solved

clear form field

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
The viewer will learn how to dynamically set the form action using jQuery.

737 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