Hi All,
My problem is in javascript.It's checking the account number and updating the data.But before updationg we have to show the popup window like "account number is exist do you want update" this.I written javascript but popup window is not displaying,without showing window it is updating the data.If we click on Yes button in popwindow window then only it must update the data.Iam sending my javascript code please check it.
function
confirmAccountNum() {
var
agree = confirm('<bean:message key="common.confirmAccountNum" />');
if (agree){
document.createCaseForm.action = "<%=request.getContextPath() %>/addCaseList.do?CAF=E&caseNo=<%=request.getParameter("caseNo" )%>";
document.createCaseForm.submit();
}
else {
return false
;
}
}
// Case Creation Account Information Save Submit
function submitForm(actionFlagValue)
{
// Save Account Information
if(actionFlagValue == "saveaccount"){
if
(<%=acctnumflag%>
{
confirmAccountNum();
}
document.createCaseForm.hidden_accinfo_accountno.value = document.createCaseForm.ac_accountNumber.value;
document.createCaseForm.hidden_accinfo_accounttype.value = document.createCaseForm.ac_accountType.value;
document.createCaseForm.hidden_accinfo_comment.value = document.createCaseForm.ac_comment.value;
var loOpenSpan = document.all["CaseAccount_1_open"];
loOpenSpan.style.display =
"";
}
and this is the logic yesterday we discussed.
ArrayList listacco = (ArrayList)request.getAttribute(
"caseAccountInfo");
if
(null != listacco){
session.setAttribute(
"caseAccountInfo",listacco);
}
/* Scriptlet Code for comparing Account Number */
Iterator iterList;
faccntnum = request.getParameter(
"ac_accountNumber");
System.out.println(
"faccntnum");
CaseAccountInfoVO caseAccountInfoVO;
iterList = listacco.iterator();
while (iterList.hasNext()) {
caseAccountInfoVO = (CaseAccountInfoVO) iterList.next();
System.out.println(
"caseAccountInfoVO");
aacctnum = caseAccountInfoVO.getAc_accountNumber();
System.out.println(
"aacctnum");
/* comparing accntnum with existing account numbers in database*/
if(aacctnum.equalsIgnoreCase(faccntnum)){
acctnumflag =
true;
break;
}
else
{
acctnumflag = false;
}
}
This acctnumflag value I am passing into if loop under javascript function.It's value is true.If true only we have to update our data.That's why I send this
string from
jsp to javascript.My doubt is how I will send jsp data to javascript for getting the operation.