Can I create a link that when clicked creates a new list item.

I dont have access to SharePoint designer :(. My goal is to make a button that says something like "Create new item" and when clicked pulls up the form to create a new item in a list. Is this posible?

Replay

By default your "new list" form will open as what is called a modal window (this is how it overlays your list) but is actually a separate page. To make it easy to get the URL of the form, you can:

  • Open your list, and in the ribbon select List Settings
  • Selected Advanced Settings Scroll to the bottom of the page and find the "dialog" heading and set to no.
  • go back to the list and select "new item" and it will open a full page view
  • Copy the URL and use that for your link.

Be sure to turn the dialog option back on if you want that when working in the list directly.

Sounds like you need a custom button that opens a new form dialog. Pop this into a Content Editor. Make sure you click the 'Edit HTML source' in the Content Editor settings:

    <script type='text/javascript'>
function OpenNewForm() {
   var listName = 'MyListUrl';
    var options =
            {
                url: L_Menu_BaseUrl + "/Lists/" + listName + "/EditForm.aspx?ID=1&IsDlg=1",
                dialogReturnValueCallback: Function.createDelegate(null, newFormClosedCallback)

            };
    SP.UI.ModalDialog.showModalDialog(options);

}

function newFormClosedCallback(result, target) {
    if (result === SP.UI.DialogResult.OK) {
        SP.UI.Notify.addNotification("List item was added.", false);
    }
    if (result === SP.UI.DialogResult.cancel) {
        SP.UI.Notify.addNotification("Add new item was cancelled.", false);
    }

}
</script>
<input value='add a new item' type='button' onclick='OpenNewForm();' id='btnNewForm' />

I added a callback that adds a notification when the form is closed. You can remove that if you want.

Category: 2010 Time: 2013-06-28 Views: 2

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.200 (s). 12 q(s)