NewForm: how can I refer to the label of a column?


  • Hi all,

    I am creating a poll by using a SharePoint survey with only 1 question.
    I want to ajust a few things (such as deleting some buttons) on the NewForm, so I created a NewForm2 in SharePoint Designer.

    In my NewForm2, there is a 'hard' referece to the question title (see screenshot below).
    So when I create a new poll (by changing the question and possible answers), the NewForm2 doesn't automatically ajust to the new poll question.
    So in my NewForm2 I need to refer to the column, in stead of having the column name in plain text.

    How do I do this?

    Tuesday, January 10, 2017 2:06 PM

All replies

  • If I am correctly getting what you want.. you just want to hide and show a few columns or buttons on the Newform, I would suggest go for JQuery or CSS.

    Do not customize the NewForm, once the form is customized, any changes ie addition or deletion of column in the list will not directly affect the Customized form, You will have to specifically add/delete the column and reference from the form.

    Wednesday, January 11, 2017 10:16 AM
  • Okay, so you imply that it is not possible to refer to the fieldvalue/label in in stead of putting it in there in plain text after every change? I get that changes in the list will not affect the customized form. But the original NewForm does the job on that part... The orininal NewForm apparently refers to the titel of the question, without using plain text for it. If I change the question in the survey, de page newform.aspx correctly displays the new question. So why can't I acchieve the same in a customized NewForm?

    If I should use JQuery or CSS, can you explain to me how that should be done? I don't have any experience on that part...

    Thank you for replying!

    Wednesday, January 11, 2017 2:32 PM
  • Use Content Editor Webpart to add the Javascript or CSS

    Edit the Page -->  Click on Add a Web Part -> Media and Content -> Content Editor

    Edit the Content Editor web part, then

    either put in the link to the JavaScript file (usually store the js files or css files in /SiteAssets/ )

    or write the js code in the Content editor webpart itself. (click on the content editor webpart -->click Edit Source and add your Js Code )

    Thursday, January 12, 2017 4:18 AM
  • Hi SharePointGeeky,

    From your description, my understanding is that the NewForm2 doesn't automatically adjust to the new poll question when you add a question in Survey list.

    When creating a new NewForm2.aspx, it create “DataFormWebPart” project instead of “ListFormWebPart” project in default NewForm.aspx.

    When users create a new question in the Survey list, it adjusts the new question in default NewForm.aspx by default and don’t adjust NewForm2.aspx.

    As a workaround, try to create a new “NewForm” after adding poll questions.

    Best regards,

    Grace Wang

    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact

    Thursday, January 12, 2017 8:52 AM
  • Hi Grace WR,

    Yes, you understand me correctly. NewForm.aspx adjusts to new poll questions, NewForm2.aspx doesn't.
    The workaround you mention would work, but it would be better if I wouldn't be needed every time a new poll is going live. I would like the user (department of Communication) being able to make new polls by herself.

    Thank you for explaining, but I was hoping you would have (a link to) the nescecary JavaScript code.
    I want to hide the 'Save' and 'Cancel' button at the top. I also would like to change the label of the other 'Save' button, and I want to direct the user to anoter page after clicking on the Save button.

    Thank you both for helping!

    Thursday, January 12, 2017 9:16 AM
  • Hi SharePointGeeky,

    According to your request, try to add script as the link below to remove “save” and “cancel” button:

    Remove “save” and “cancel” at the top:

    Refer to the link below to redirect the page after you click save:

    Best regards,

    Grace Wang

    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact

    Tuesday, January 17, 2017 10:04 AM