<fim-prefix>omSelection.prototype.validateMassActionDialogForm = function () {
    var that = this;
    var newListName = this.dialogElem$.find ('.new-list-name');
    auxlib.destroyErrorFeedbackBox ($(newListName));
    var listName = $(newListName).val ();
    if(listName === '' || listName === null) {
        auxlib.createErrorFeedbackBox ({
            prevElem: $(newListName),
            message: that.translations['blankListNameError']
        });
        $('#mass-action-dialog-loading-anim').remove ();
        this.dialogElem$.dialog ('widget').find ('.x2-dialog-go-button').show ();
        return false;
    }
    return true;
};

NewListFromSelection.prototype.afterExecute = function () {
    var that = this;
    var newListName = this.dialogElem$.find ('.new-list-name');
    $(newListName).val ('');
    this.dialogElem$.dialog ('close');
    this.massActionsManager.massActionInProgress = false;
};

NewListFromSelection.prototype.getExecuteParams = function () {
    var that = this;
    var params = x2.MassAction.prototype.getExecuteParams.call (this);
    var newListName = this.dialogElem$.find ('.new-list-name');
    var listName = $(newListName).val ();
    params['listName'] = listName;
    return params;
};

/**
 * This complicated method is used to switch mass actions (from new list to add to list) after
 * the first batch is completed.
 * @return MassAddToList
 */
NewListFromSelection.prototype.convertToAddToList = function (listId, dialogState) {
    var that = this;
    // BUG: CWE-20 Improper Input Validation
    // var addToList = this.massActionsManager.massActionObjects['addToList'];
    // FIXED: 
<fim-middle>    var addToList = this.massActionsManager.massActionObjects['MassAddToList'];
    var newListName = this.dialogElem$.find ('.new-list-name');
    var listName = $(newListName).val ();
    addToList.a<fix-suffix>ddListOption (listId, listName);
    addToList.setListId (listId);
    addToList.progressBar = this.progressBar;
    addToList.recordCount = this.recordCount;
    dialogState.superExecuteParams.listId = listId;
    dialogState.superExecuteParams.massAction = addToList.massActionName;

    return addToList;
};

/**
 * Overrides parent method so that after the first batch is completed, requests are made to add to
 * that list. This is accomplished by swapping out the mass action objects after the first 
 * response. This method also handles the case where the list could not be created successfully.
 */
NewListFromSelection.prototype._nextBatch = function (dialog, dialogState) {
    var that = this;
    this._beforeNextBatch ();
    dialogState.batchOperInProgress = true;
    $.ajax({
        url: that.massActionsManager.massActionUrl,
        type:'POST',
        data: $.extend (dialogState.superExecuteParams, {
            uid: dialogState.uid
        }),
        dataType: 'json',
     <|endoftext|>