.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Hide Fields on NewForm.aspx

Posted By:      Posted Date: October 08, 2010    Points: 0   Category :SharePoint

I put the following javascript code in the NewForm.aspx.

<script language="javascript" type="text/javascript">

function findacontrol(FieldName)
 var arr = document.getElementsByTagName("!");
 //Get all comments
 for (var i=0; i < arr.length; i++)
  // now match the field name
  if (arr[i].innerHTML.indexOf(FieldName) > 0)
   return arr[i];

function hideFields()
 var control = findacontrol("Status");
 control = findacontrol("Action");
 control =findacontrol("Raw Material Solution");
 control = findacontrol("Outcome");
 control = findacontrol("Progress Notes");
 control = findacontrol("Closure Notes");<

View Complete Post

More Related Resource Links

NewForm.aspx - Show/Hide fields dynamically

I have about 20 + fields in a custom list.  I want to be able to show and hide fields depending on user selection.  Does anyone know a way of accomplishing this? Ive tried some embedded javascript but can't seem to get it working in sharepoint. Please help :)http://lbellows.blogspot.com http://www.ptreviews.net

how to hide/display controls in NewForm.aspx based on dropdown value in SharePoint list



I have 1 dropdown in my sharepoint list with other columns. If dropdown value equal to 'xyz' i need to display some other controls, otherwise these controls should be hidden.

I know we can achieve this with javascript. If any one can provide code or sample then it will be appreciated. or is there any other alternative methods to do this ........

Thanks & Regards, Neerubee

Getting user control in NewForm.aspx of the list


I have designed a user control where i have placed some custom fields as per my requirement now my next step is as soon as user clicks 'Create' under Site Settings it should take him to my user control page instead of Newform.aspx default page of the list.Just let me know your suggestions to achieve this as it would help me a lot

Thanks & Regards,


Populate NewForm fields using QueryString

Hi, I know this has been talked about before, but wanted to know if there is new and better approaches? We have many different lists with lookups to other lists. Lets use the Customer and Contact example? The contact list has a lookup to the customer list. I want to be able to call /Lists/Contacts/NewForm.aspx?Customer=Customer A and have the field "Customer" populated with "Customer A" I have tried http://www.endusersharepoint.com/2009/04/20/jquery-for-everyone-pre-populate-form-fields/ but this only works for text fields for some reason, choice field, lookup fields etc. does not get populated. Also most of the examples use a CEWP, but I would really like the script to be loaded in the master page so it will work with less customization on the the NewForm.aspx pages, as we might add new lists that need this feature. Hope you can share some insight on how this is possible :) --  Christian

SharePoint 2007, Modify Tooltip Text in SharePoint forms: EditForm.aspx and NewForm.aspx

I have a list in SharePoint that was created awhile back.  The names assigned to some of the columns in the list are no longer relevant.  Due to existing code, the column names cannot be modified to reflect the preferred names.  I was able to change the lables assiciated with these fields within forms NewForm.aspx and EditForm.aspx.  All looks and works just fine except for when the curser lingers in one of these fields, the tooltip that appears contains the underlining (original...no longer relevant) column names.  This is confusing to the user since the name within the lable and the tooltip are different.  I would like a way to either disable the tooltip from displaying or to modify it to display a custom value.  Below is the code from behind the form as it appears in Sharepoint Designer.  I would appreciate some input on this. <SharePoint:FormField runat="server" id="ff11{$Pos}" ControlMode="Edit" FieldName="My_x0020_Field_x0020_Name" __designer:bind="{ddwrt:DataBind('u',concat('ff11',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@My_x0020_Field_x0020_Name')}"/> <SharePoint:FieldDescription runat="server" id="ff11description{$Pos}" FieldName="My_x0020_Field_x0020_Name" ControlMode="Edit"/>


Hello, in my lists, i'm trying to figure out how to open the Newform.aspx in a new window. I've read all other  solutions but they don't seem to be very clear. What i want is when a user clicks on a the new button (Add a new item to this list) the form should open in a new window, and then once its been completed, and the user clicks ok, it should refresh the page and redirect to the AllTtems.aspx with the new list item that was created displayed. Please if anyone has a code to perform this. Help. Thanks for your assistance -Ug

change focus on controls in sharepoint list newform.aspx

hi all. i have newform.aspx where i hav required fields . when i say ok to enter the values the required field valiedates and shows error messages. but the problem is that the focus where it is suppose to get placed is promting in differnet place. can i change the focus of the controls inside newform.aspx or editform.aspx?jayaraja

How to add a new button to the newform.aspx page which says "Save and add another record" ?

Team, I have a scenario where my client wants me to add a nother button to NewForm.aspx page in addition to Save and Cancel buttons. The job of that buttom should be to save the record and open that new form again. Is this possible.If yes can you guie me how to do it though designer? Thanks in advance. Deepti.  

How to preset lookup value in newform.aspx?

Trying to preset value of "contract" value in "payments" newform.aspx: var tmp = new Array();   var tmp2 = new Array();   var get = location.search; if(get != '') {  tmp = (get.substr(1)).split('&');  for(var i=0; i < tmp.length; i++) {   tmp2 = tmp[i].split('=');    if (tmp2[0]="contract")   {    document.getElementById("ctl00_m_g_74acdc2d_d0d7_40f0_92fe_591f907f295a_ctl00_ctl05_ctl03_ctl00_ctl00_ctl04_ctl00_ctl01").value=tmp2[1];    break;   }  } } User see that correct value (translated through url) is choosed. But after user saves new item, it's appers with empty value of "contract" field.

Custom Fields not showing up in NewForm

Hello everybody,   I have got a very strange problem. I got two SP-Websites with several lists on them. Both have the same ContentTypes added (Standard CT is a Document-derived CT) however the 'Folder'-derived CT (including some additional fields like internal SAP numbers) is behaving differently in the lists. On the one List when I click on 'New Document'-'TestFolder' it is displaying all the added fields and in the other list it is only displaying the 'Name'-Field.   I have compared all the attributes of the Lists and also of the added Columen via Sharepoint Manager 2010 and found no differences whatsoever between them. It seems to be another problem caused by via Site-Template generated SP-Websites (including the libaries). When I create a new List on the Website and add the CT to the List all fields get displayed correctly? What could be the problem here with the Template-based lists?   Has anyone encountered the same problem once? Thank you for your help! Best regards, Martin

how to do a ajax integrated validation in required field sharepoint newform.aspx

hi all, i have newform.aspx in sharpeoint list where in i have 2 cols which are reqd field. how would i make the server side validation without refreshing the page.. can i put it ajax update panel ?  how would i achieve this requirement.jayaraja

problem in newform.aspx override class

Hi All Im facing a wierd problem, I have a custom list, im trying to override its newform.aspx page class with custom class. in Page_load event of the class Im checkig for one value in query string, if value exists then I have to select a dropdown field in the list. other wise not to select any value. After that i save the record.  Here only the PROBLEM comes. when I use my code it is NOT inserting new record. When I comment my code it is inserting new record. I do not understand whats the problem in my code. PLEASE help me to overcome this. Here is the code protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //When ERID is not null, it means request is coming from employee page if (HttpContext.Current.Request.QueryString["ERID"] != null) { FinishMyJob(); } } private void FinishMyJob() { SPSecurity.RunWithElevatedPrivileges(delegate() { string _StaffAppRecId = null; Boolean _IsFound = false; SPWeb _web = SPContext.Current.Web; SPList _list = _web.Lists[SPContext.Current.ListId]; SPList _lstEmp = _web.Lists["Employee"]; SPListItem _EmpLstItem = _lstEmp.GetItemById(Convert.ToInt32(HttpContext.Current.Request.QueryString["ERID"])); string _strEmpName = Convert.ToStri

redirecting from EditForm.aspx. to NewForm.aspx directly


Hi All,

My Requirement is...

I have two lists. List "Project Request" and "Project List". When I am upading a item from "Project Request" list in EditForm.aspx. After clicking on the ok the aplication should redirect me to NewForm.aspx of ProjectList.

I have checked in so many blogs it can be achieved through EventReciver only. But not able to ressolve how to achive.

Please help me with code snippet.

Thanks in Advance.....


How to display the List "NewForm.aspx" without masterpage



   I want to add the new item to the list, the name of the list called "Mylist". I have the link in the another sharepoint site page.The requirment is when the user click on the link, the popup window will come and inside that "NewForm.aspx" of myList will display. normally if we display masterpage also get display i dont want to display the masterpage. Just i want to display "NewForm.aspx" in side the POPUP window. How to display like this?

how to hide .aspx extension for multiple pages


In MVC it's very easy to control routing.


In my classic ASP.NET application I want to "hide" .aspx extension


I can do it with new ASP.NET 4 feature: MapPageRoute

  1. routes.MapPageRoute("login""login""~/login.aspx");  
routes.MapPageRoute("login", "login", "~/login.aspx");


Now http://site.com/login will work. But I have more than 50 pages, and adding 50 rules is ridiculous.


How can I solve this?


create a custom "newform.aspx" for document library using sharepoint designer and web services


Hi All,

I need to change the look and feel of "NewForm.aspx" for my Sharepoint 2007 Document Library. But the constraints are

1. I cant use C# coding. No Visual Studio.

2. Not allowed change anything in the farm level. e.g. cant install features/webparts fo this.

3. Can only use JavaScript, JQuerry and Sharepoint Designer 2007.

I came across some suggestions that we can create a custom page in Javascript/JQuery. Which will take all input data and insert new items in list/doc library using some XML services.

Please help me, I dont know if this is really possible. Let me know if any alternative is possible.

Version History for NewForm.aspx


Hi All,

I urgently need to switch back to one of the previous versions of the customized Newform.aspx  form . I dont see any option when i right click on the form but in the properties i see the version as v2.0

any help is appreciated.


Isha kapoor My SharePoint Blog Follow me
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend