停止ボタンを押したときに grails に確認メッセージ ボックスを実装する必要があります。私の停止ボタンのコードは
<a class="stopimg" href="${createLink(controller: 'Test', action: 'Stop', id: i.Id)}"> Stop </a>
確認メッセージボックスも作成しました。
<div id="popup_box2">
<div class="popup-warapper">
<form name="">
<div class="popup-title"><a id="popupBoxClose2" class="popup-close"><img alt="close" src="images/close.png"></a>
<div class="title">Confirmation</div>
<div class="clear"></div>
</div>
<div class="popup-content">
<div>Are you sure you want to Stop the server?</div>
</div>
<div class="buttons"> <span>
<input class="popupBtn" type="button" value="Yes" name="stop_service" id="stop_service" />
<input class="popupBtn" type="button" value="No" name="none" id="none" />
</span> </div>
</form>
</div>
</div>
これを頭の中で読み込んでいます
$('.stopimg').click(function(){
// When site loaded, load the Popupbox First
loadPopupBox2();
});
$('#popupBoxClose2').click( function() {
unloadPopupBox2();
});
function loadPopupBox2() { // To Load the Popupbox
$('#popup_box2').fadeIn("slow");
$('#popup_box2').css({ "left":(screen.width/2)-(285/2)});
$("#mainWrapper").css({ // this is just for style
"opacity": "0.3"
});
}
function unloadPopupBox2() { // TO Unload the Popupbox
$('#popup_box2').fadeOut("slow");
$("#mainWrapper").css({ // this is just for style
"opacity": "1"
});
}
これを何らかの方法で停止ボタンにリンクする必要があります。HTMLボタンを使用するとコードは機能しますが、grailsで使用すると機能しません