SP List validation refresh page on submit does not retain custom dropdown value

Shri-6058 326 Reputation points
2020-11-20T06:47:25.297+00:00

I have a a script editor having dropdown control. The value automatically fills via Jquery on load.

<select name="items" id="ctl00_DropDownChoice">
<option value="_select">_select</option>
</select>

I am assigning selected text value to hidden SPlist text field. The text everything retains but the custom dropdown value selected doesn't retain but display "_Select" instead of selected value when submit list item and when missing required field validation happens.

I tried global variable assigning selected values and document ready set dropdown value with global variable, it doesnt work. A kind of postback is what required. Please help.

SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,340 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,684 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,608 questions
0 comments No comments
{count} votes

Accepted answer
  1. Baker Kong-MSFT 3,801 Reputation points
    2020-11-23T02:25:30.887+00:00

    Hi @ShridharHegde-2034,

    The options filled in the dropdown control come from an asynchronous request. When the page reloads, $('#CT100_DropdownChoice').val(selItem); won't take effect as there is no such an option at that time.

    So you can put the above snippet in the callback of the request:

    41639-image.png

    Test:

    41742-test.gif

    Best Regards,
    Baker Kong


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Shri-6058 326 Reputation points
    2020-11-24T04:25:58.613+00:00

    That's exactly what its working. Thanks so much!

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.