* prevent showing message on first submit button, bug #36535.

This commit is contained in:
liwenrui
2023-07-14 09:50:11 +08:00
parent 30a89ec066
commit 4bdc7aa5ce
2 changed files with 23 additions and 1 deletions
+1 -1
View File
@@ -310,7 +310,7 @@ class ai extends control
if(!empty($data->goTesting)) // Go to testing object view.
{
$location = $this->ai->getTestingLocation($prompt);
return $this->send(empty($location) ? array('result' => 'fail', 'message' => $this->lang->ai->prompts->goingTestingFail) : array('result' => 'success', 'message' => $this->lang->ai->prompts->goingTesting, 'locate' => $location));
return $this->send(empty($location) ? array('result' => 'fail', 'target' => '#go-test-btn', 'msg' => $this->lang->ai->prompts->goingTestingFail) : array('result' => 'success', 'target' => '#go-test-btn', 'msg' => $this->lang->ai->prompts->goingTesting, 'locate' => $location));
}
if($isJumpToNext)
@@ -147,6 +147,28 @@ $(function()
/* Enable buttons after going testing. */
$('#mainForm').ajaxForm({
success: function(response, status)
{
var message = response.msg;
var location = response.locate;
var target = response.target ? response.target : '#submit';
if(message)
{
var $targetSubmitBtn = $(target);
if($targetSubmitBtn.length)
{
$targetSubmitBtn.popover({
container: 'body',
trigger: 'manual',
content: message,
tipClass: 'popover-in-modal popover-success popover-form-result',
placement: 'right',
}).popover('show');
setTimeout(function() {$targetSubmitBtn.popover('destroy');}, 2000);
}
}
if(location) setTimeout(function() {$.apps.open(location);}, 1200);
},
finish: function(response, _, $form)
{
if(response.locate) setTimeout(function() {$.apps.open(response.locate);}, 1200);