0

How to create a custom form to submit. I have created a form in SharePoint Designer and once we click on the submit button in SharePoint I want it to be saved in a list. Can anyone tell me how I can do that. Example: Name: Date: Phone: and then Submit button. which when selected show save in my list in SharePoint which can be used for viewing and printing.

Thanks Mohammed

  • Just a query, Why you created a custom form? Why you didn't used default listforms of sharepoint list? – P S Apr 28 '15 at 5:11
0

Hi,you should use Jquery or Java script to get this done easily,

Here you go, ' var newTask;

$('#btnAddTask').click(function () {
    var taskTitle = $('#txtTaskTitle').val();
    var taskDesc = $('#txtTaskDescription').val();

    var ctx = new SP.ClientContext.get_current();
    var taskList = ctx.get_web().get_lists().getByTitle('Tasks');
    // use ListItemCreationInformation to provide values..
    var taskItemInfo = new SP.ListItemCreationInformation();
    newTask = taskList.addItem(taskItemInfo);
    newTask.set_item('Title', taskTitle);
    // could set other fields here in same way..
    newTask.update();

    ctx.load(newTask);
    ctx.executeQueryAsync(addTaskSuccess, addTaskFailure);

    function addTaskSuccess(sender, args) {
        $('#addResult').html("Task " + newTask.get_item('Title') + " added to the Tasks list");
    }

    function addTaskFailure(sender, args) {
        alert('Failed to add new task. \nError: ' + args.get_message() + '\nStackTrace: ' + args.get_stackTrace());
    }
});

'

this for script just change the lists names and button names as your form SP designer,

more details in

http://www.sharepointnutsandbolts.com/search?q=ajax

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.