none
Update multiple fields on OOTB Task form from URL querystring parameter RRS feed

  • Question

  • Hi, I have the following JavaScript code under the <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server"> in NewForm.aspx. 

    - Alerts appear just fine (for testing)

    - 'Task Name' and 'Description' or Body fields are not populated with the values from the Query
    string (see below)

    - 'Priority' is set properly

    Here is the URL containing the string parameters:

    …/Lists/Certification%20Tasks/NewForm.aspx?Title=Here%20is%20the%20Title&Desc=Here%20is%20the%20Description&Priority=(3)%20Low

    I am using SharePoint 2013.

    I also tried changing "Task name" in the code to use "Title".

    Why wont the code work for those 2 fields?  Only the Priority field is updated as expected but the Task (or Title) field remain blank when the New form appears.  Perhaps I'm missing something?

    Here is the screen shot of the code in NewForm.aspx:

    Here is the screen shot of the New Task Form using the URL with parameters above to create it:




    • Edited by betcha663 Tuesday, August 29, 2017 1:34 PM
    Tuesday, August 29, 2017 1:26 PM

Answers

  • Hi

    Try this

    $("input[title='Task Name Required Field']").val(Title) ;

    Sure it will work this time .

    • Marked as answer by betcha663 Tuesday, August 29, 2017 7:14 PM
    Tuesday, August 29, 2017 6:03 PM
  • try this

    $('nobr:contains("Description")').closest('tr').find('input[id$="TextField_spSave"]').val(Desc) ;

    or

    $('nobr:contains("Description")').closest('tr').find('.ms-rtestate-write')[0].innerText = Desc ;


    • Edited by MeRagZ Tuesday, August 29, 2017 7:00 PM
    • Marked as answer by betcha663 Tuesday, August 29, 2017 7:14 PM
    Tuesday, August 29, 2017 6:53 PM

All replies