Part of Keeping things simple is coding yourself.... You don't have to use frameworks to do SIMPLE things..... Here is a Javascript, Jquery error handler on a button click,. Calls a servlet on the server....... KIS!
//GLOBAL VARIABLES
var G_MSGTITLE;
G_MSGTITLE = "_________________________________________\n\n";
G_MSGTITLE += "CLIENT VALIDATION ERRORS\n";
G_MSGTITLE += "This form was not submitted because of the following error(s). \n";
G_MSGTITLE += "Please correct these error(s) and re-submit.\n";
G_MSGTITLE += "_________________________________________\n\n";
var G_MSG;
/**
* Function Name: setloadVCvoucherrecord()
* Description : Sets the jQuery controls
* Parameters: None.
* Return: None.
*/
function setloadVCvoucherrecord(){
$(document).ready(function() {
//BUTTON TO GO TO UPDATE Cancer Care Agreement
$('#UpdateCCA').click( function () {
try{
var fileIndex = 0;
G_MSG = "";
$.each(table3.row('.selected').data(), function(index, value){
if ( index===0 ){
fileIndex = value;
}
});
//Add Parameter to form
$("#CCAfileIndex").val(fileIndex);
if (fileIndex === 0 ){
G_MSG += "Error - No file selected.\n";
}
if (G_MSG.length > 0)
throw G_MSG;
//Keep Form on Same window
$('#frmVoucherRecord').on('submit',function(){
$(this).attr("target", "_parent");
$(this).attr( "action", "UpdateCancerCareAgreement");
});
}catch( err ){
alert(G_MSGTITLE + err );
return false;
}
});
//END OF BUTTON TO GO TO UPDATE Cancer Care Agreement
});
}
No comments:
Post a Comment