I have a list with some fields and a button, if a user enter a numeric value in one field and then click a button then I need to generate 5 columns automatically in each click of the button ??

NB:The button click must be equal to the numeric value specified in the field just above the button

  • Not sure if you want to actually create new columns on button click OR just display the already added columns on button click in the form.
    – Yayati
    Sep 11 '17 at 9:20
  • I need to display a set of new columns in each click
    – SSK_NK
    Sep 15 '17 at 4:54

You can use plain HTML table and JavaScript to achieve this. I will try to give you high level instructions for the same -

  1. Add a content editor webpart to your form, and then create a html table using plain HTML. Add the field that gives you the number of columns you want to the html table. Insert the button to generate columns here. This needs to be done in your NewForm.aspx page of the list

  2. Create a javascript function, that adds the new columns based on input from Step 2 using insertRow() method

  3. Take the data from the newly created columns, and concatenate them together in some form of delimiter(#,$$,etc)

  4. Finally save all these data into your list using JS methods for sharepoint

  5. For displaying the data, create a new JS method in the document.ready() method, that queries the ID in the URL for EditForm.aspx and DispForm.aspx pages and displays the data in the HTML tables created in the respective aspx pages, using similar method in Step 1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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