Solved

Reset values

Posted on 2014-04-01
3
192 Views
Last Modified: 2014-06-01
I have lookup columns in the newform in SharePoint 2010.  I have a reset button on the form, which refreshes the fields using Form action.  All the other fields value is cleared on the form  except for the lookup columns. how to clear the lookup values on the newform? Please help.
0
Comment
Question by:ven1234
3 Comments
 
LVL 9

Accepted Solution

by:
Sar1973 earned 500 total points
ID: 39974402
Try this script:
function resettaform() {
	
	var myControlI = document.getElementsByTagName("input");
	var myControlS = document.getElementsByTagName("select");
	var myControlT = document.getElementsByTagName("textarea");
	for (var i=0; i<myControlI.length; i++) {
		if (myControlI[i].getAttribute("type") == "checkbox" ||
		myControlI[i].getAttribute("type") == "radio") {
			if (myControlI[i].getAttribute("name") == "Assistenza_scelta") {
				myControlI[i].checked=true;
			} else {
				myControlI[i].checked=false;	
			}
		} else {
			myControlI[i].value="";
		}
	}
	for (var j=0; j<myControlS.length; j++) {
		myControlS[j].options[0].selected = true;
	}
	for (var k=0; k<myControlT.length; k++) {
		myControlT[k].value= "";
	}

}

Open in new window

0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…
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)
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…

706 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

20 Experts available now in Live!

Get 1:1 Help Now