Solved

Reset values

Posted on 2014-04-01
3
197 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Triple line in an alert message 4 19
Html using "Or" in condition 3 24
javascript form - error when hitting enter 3 26
Table header must be on top 2 20
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
In case you ever have to remove a faulty web part from a page , add the following to the end of the page url ?contents=1
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…

685 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