Important Update: Community URLs redirect issues are partially resolved. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

Submit Button Code Won't Save Like It Should

AmyJoJarboe
Contributor III

Hello! I recently decided to add a submit button to a questionnaire and am now having some issues. It is supposed to change a value and then save & close the file. However, it says "Saving..." and then says "There are unsaved changes do you still want to close the file?" Instead of just saving and closing like it did in the past. What's wrong with the way I'm doing it? Here is the code:

<div class="toolbar-app-buttons-left">
     <a title="Set Value" class="tb-btn-link-left" id="btnSetValue" href="javascript:void(0);" data-check-dirty="false">
          <div class="tb-btn" data-icon="&#xE348" data-icon-pos="left">Submit</div>
     </a>
</div>

<script type="text/javascript">
     var integration = {
          statusFieldId:"<correct ID is here>",
          statusSubmit:"<correct ID is here>"
     };

     $('#btnSetValue').click(function(){
        UpdatesValueList(integration.statusFieldId, integration.statusSubmit);
  ShowAnimationAndPostback('master$btnSave')
     });

     function UpdatesValueList(changeId, assignedValue) {
        var valueArray = new Array(1);
        valueArray[0] = assignedValue;
        $CM.setFieldValue(changeId, valueArray, '');
     }
 </script>
1 ACCEPTED SOLUTION

Accepted Solutions

Ilya_Khen
Champion III

Try to use:

$('#master_btnSave').click();‍‍

instead of

ShowAnimationAndPostback('master$btnSave')

View solution in original post

11 REPLIES 11

Ilya_Khen
Champion III

Try to use:

$('#master_btnSave').click();‍‍

instead of

ShowAnimationAndPostback('master$btnSave')

Perfect, thank you!!! Why does the line you wrote work while mine doesn't?

Well, clicking on submit of btnSave is emulating direct user click

Amy, the ShowAnimationAndPostback('master$btnSave') was used back in the 5.x days and the way Archer saves records in 6.x is handle differently now

 Advisory Consultant

And I see that this code is returning back in 6.7  At least I saw it on new Save1 and Apply1 buttons.

AmyJoJarboe
Contributor III

Thank you guys so much!! I really appreciate it!

$('#master_btnSave').click(); this one creating non stop loop .  

You probably have hijacked the original save button then or have another piece of code during realod.

Hard to say without full picture.

Thank you, buddy, for the quick reply below code kind of sends one more click event to the save click event and it goes into the loop: 

 

$('#btnSetValue').click(function(){
        UpdatesValueList(integration.statusFieldId, integration.statusSubmit);
 
$('#master_btnSave').click();

     });

So instead I am just passing only validation function to this and it works now : 

 

$('#master_btnApply').click(function(){
varHelperIsupdated = check_and_populate_Process();

});

 

Thanks a lot : )