I have a sharepoint 2007 list and it has 6 site columns, want to have two modes of newform.aspx page. When user clicks on Newitem, it should display only 3 site columns and there should a link to the advanced mode, when user clicks on the advanced mode link it should display all those 6 site columns and corresponding column values should be pre-populated if user already enters some information in the simple mode. And user should be able to go simple mode from the advanced mode.

I also want to display current user's name on the label is in the NewForm.aspx page

How it can be achieved? Dowe need to write some kind of javascript?

3 Answers 3


You could do this fairly easily using SPUtility.js (full disclosure this is a library I maintain). You would probably put it all inside a Content Editor Web Part on the NewForm.aspx.

You would have your "advanced mode" link that would toggle showing/hiding the fields. Example using SPUtility.js:

SPUtility.GetSPField('Field A').Hide(); // or Show() after they click the link
SPUtility.GetSPField('Field B').Hide();
SPUtility.GetSPField('Field C').Hide();

Let me know if you choose to go this route and I can help with the rest.

  • can you share me the implementation details. Dec 25, 2010 at 2:42
  • does it make any performance issue? Dec 25, 2010 at 2:59
  • For installation see here: sputility.codeplex.com/wikipage?title=Installation. Essentially you are just putting your JavaScript inside a Content Editor Web Part. You'll probably also put your link inside another CEWP that calls your JavaScript function. As for performance, the page may take longer to load? Not sure what else you would be worried about?
    – Kit Menke
    Dec 28, 2010 at 14:32

JavaScript seems the way to go as you want to add some dynamic behavior to the page, but apparently you don't need any additional information from the server.

Your code will have to:

  • identify the 3 rows that need to be hidden
  • make them invisible (display:none or visibility:hidden)
  • toggle the visibility on click

JavaScript should also allow you to retrieve the current user name (either display name or better user account).

  • can you give me a sample, just the core logic, how to hide the site columns using javascript? Dec 19, 2010 at 16:04
  • See for exampe the first sample script here: sharepointboris.net/js/library The logic is that the field name is also in the title attribute in the html.
    – Christophe
    Dec 22, 2010 at 2:42

Another way to do this would be to use your EditForm to act as the 'advanced form' (assuming you want all 6 fields to be visible when a user is editing the list item). Then, a simple redirect when the user clicks 'OK' will take you to the edit/advanced form with the values you entered preserved.

For the redirect, the obvious question is how do I redirect to an item's edit form without the item's ID? (the ID is not created until the list item is saved). Try Marc D Anderson's SPServices Library - http://spservices.codeplex.com/. Marc has written a function to specifically address this problem -> $().SPServices.SPRedirectWithID.

You can also use Marc's SPServices library to display the current users name (and more) using the $().SPServices.SPGetCurrentUser utility.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.