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


Top 5 Contributors of the Month
ASPEvil
Ashutosh Jha
Jean Paul
satyapriyanayak
SP
Post New Web Links

NewForm.aspx - Show/Hide fields dynamically

Posted By:      Posted Date: August 30, 2010    Points: 0   Category :SharePoint
 
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


View Complete Post


More Related Resource Links

Hide Fields on NewForm.aspx

  

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

<script language="javascript" type="text/javascript">
_spBodyOnLoadFunctionNames.push("hideFields");

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.parentNode.parentNode.style.display="none";
 control = findacontrol("Action");
 control.parentNode.parentNode.style.display="none";
 control =findacontrol("Raw Material Solution");
 control.parentNode.parentNode.style.display="none";
 control = findacontrol("Outcome");
 control.parentNode.parentNode.style.display="none";
 control = findacontrol("Progress Notes");
 control.parentNode.parentNode.style.display="none";
 control = findacontrol("Closure Notes");<

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

  

Hi,

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

Issues with dynamically created TabContainer (Hide/Show TabPanel)

  

I have a web page that contains an UpdatePanel. In that panel, there is a TabContainer control that has 5 TabPanels, only the first one "Tab 1" will be displayed during initial page load. There is an Add button in "Tab 1", whenever it gets clicked, I will add (show) the next TabPanel (Tab 2, Tab 3, etc., all the way to Tab 5). "Tab 2" thru "Tab 5" contains a Close button that will close (hide) the current tab when clicked.

I'm doing all of these from code behind (dynamically create controls in Page_Init event and re-generate them during postback, track each TabPanel's content in a session variable, etc.), and everything seems to work just fine IF after adding several TabPanels, I remove  them in order (i.e. remove Tab 5 first, then Tab 4, Tab 3, etc.). It will NOT work whenever I try to remove a tab in the middle, then I will get all kinds of strange results.

I've attached the sample codes here for reviewing and testing. Any help is greatly appreciated.

 

==================== demo.aspx page ====================

<%@ Page

New added field in newform.aspx doesnt show in disp.aspx

  

Hi,

I have added a new field in my newform.aspx ,called Customer. Its dropdown list bound to sql db.

It works fine and is populating list of customers but the value chosen here is not showing up in dispform.aspx page.

I m just completely stuck. Any suggestions please.


Hide a measure group in excel 2007 'Show Fields Related to'

  

Hi All,

I know that if a I want to hide a measure group to users I have to set the properties 'Visible' to false for all the measure of the measure group.

But when I open a connection to the cube with Excel 2007 I see again the measure group in the drop down list 'Show Fields Related to' in the 'Pivot Table Fields List'.

I don't see it in the measure group list when I choose 'All' in the 'Show Fields Related to', but i don't want to see it in the list 'Show Fields Related to' too.

 

How I can do to hide permanently the measure group?

 

Thank you all,

SimonaP


Show/Hide fields on InfoPath based on context User Group Membership

  
I am reading a book on SharePoint 2010 Development by Wrox and although it is a good book, the InfoPath section is limited. I am Googling to see if I can find anywhere where i can perhaps have this type of functionality to hide and show a specific field based on their Group Membership?
Victor Palma

How to dynamically hide stock edit/display form?

  

How can I dynamically hide/show the stock edit or display form of a list item?


Getting user control in NewForm.aspx of the list

  
Hi,

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,

Sudheer

Show/hide dashboard items Sharepoint

  

Hello!

I'm having a problem with trying to filter the appearence of items on a sharepoint site by having a dropdown list and filter according to the current value, The method i am using atm is by having javascript and by looping through all the <td> on page. This works for list views, But not for Performance point dashboard objects/web parts, +

Is there a way to somehow get the title of all performance point objects on a page, fill the dropdownbox show/hide depending on the selected item in the box?

 

BR


Is it possible to use multiple date fields to have an event show more than once on a Sharepoint 2007

  
Hello, Is it possible to use multiple sets of start and end times to have events display multiple times in a sharepoint calendar? To clarify: - I have the standard fields of "Start Time" and "End Time" in my calendar list. - Events show on the calendar just fine. - Would like to create additional fields called "Start Time 2" and "End Time 2" within the same record and have the event show multiple times on the calendar. - The recurrence functionality of sharepoint will not meet my needs because the pattern I need to use is not in one of the allowed choices. Thanks in advance, John

How to sequentially show/hide

  
I appologize upfront if this is a noob question.  I have to teach myself this stuff and have no one to ask questions of.  I promise I searched both online and in books for the answer before posting, but still can't make sense of this. Initially I should state that this is all supposed to be wrapped up in a modalPopup.  I have no problem getting the popup to trigger and display, the issue is the content. I need to create a page that will display a series of paragraphs sequentially (instructional material).  I would like to have each "step" of the instructions put into a <div> with a "next" button that lets the user confirm that they have understood the step and ready for the next step.  I would assign each <div> a unique id, eg. "Div1", "Div2", "Div3", etc. I would assign the "visibility" attribute of Div1 to "visible", and all other Div's to "hidden".  When the user clicks the "next" button, Div1 would have its "visibility" attribute changed to "hidden" and Div2 changed to "visible".  This process would repeat until all the steps have been completed. I have seen some code that uses the system method getElementByID() but I just simply could not figure out how to get it going.&n

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"/>

Show total items for GridView in List.aspx or GridViewPager

  
Hi, Is there a solution to show total items in Grid View in List.aspx or GridViewPager Eg. Record: 1 - 20 of 231 
Categories: 
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