Click here to Skip to main content
15,891,253 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I am breaking my head with a javascript error that I am getting. I am trying to create a modal Popup using javascript. The javascript code that I am using is:

JavaScript
function OpenModalDialogCredit(RRID, SLA_Bucket, AccountNum) {
            var vReturnValue;
            var AccountNo = new String();
            AccountNo = AccountNum.toString();
            var url = "RR_Txn_Detail.aspx?RRID=" + RRID + "BucketID=" + SLA_Bucket + "AccNum=" & AccountNum;

            if (url != null) {

                vReturnValue = window.showModalDialog("Risk_Report_Weekly_Txn_Detail.aspx?RRID=" + RRID + "&BucketID=" + SLA_Bucket + "&AccNum=" + AccountNum + "&DtCt=" + 2, '', 'dialogWidth:800px,dialogHeight:1200px,scroll:1,center:yes;unadorned:yes', 'screenx=100', 'screeny=100');


            }
            else {
                alert("No URL passed to open");
            }

        }


The above code works when AccountNum is a Number but when AccountNum has letters and Numbers, I get an error saying: SCRIPT5009: 'NAD197005601' is undefined. Now 'NAD197005601'is the AccountNum parameter that is passed into the function but for some reason it says its undefined.

Please help me.

thanks
Posted

I think you forgot some important characters in your url ; see below:
C#
var url = "RR_Txn_Detail.aspx?RRID=" + RRID + "&BucketID=" + SLA_Bucket + "&AccNum=" & AccountNum;

But it would be even better to construct your URL this way:
C#
var url = string.Format("RR_Txn_Detail.aspx?RRID={0}&BucketID={1}&AccNum={2}", RRID, SLA_Bucket, AccountNum);

Much more clear to read and eventually debug.
Hope this helps.
 
Share this answer
 
Private Sub OpenViewDetailWindow(ByVal BugId As String, ByVal action As Actions, ByVal Mode As Mode, ByVal OldBugStatusId As String, ByVal MaxStatusId As Status, ByVal MaxStatusById As String)
Dim oPopupWindowParameters As PopupWindow_Parameters = New PopupWindow_Parameters
With oPopupWindowParameters
.ActionTaken = action
.BugId = BugId
.Mode = Mode
.OldBugStatusId = OldBugStatusId
.MaxStatusId = MaxStatusId
.MaxStatusById = MaxStatusById

End With
Session("PopupWindowParameters") = oPopupWindowParameters
Dim JScrip As StringBuilder = New StringBuilder
Dim Location As String = Request.ApplicationPath & "/BugTrack/ViewCallDetails.aspx"
Location = Location & "?action=" & action
JScrip.Append("<script language='javascript' type='text/javascript'>" & vbCrLf)
JScrip.Append(" var WinSettings = 'center:yes;resizable:no;dialogWidth:800pt;dialogHeight:500pt';")
JScrip.Append("window.showModalDialog('" & Location & "', window, WinSettings);")
'JScrip.Append("window.open('" & Location & "');")
JScrip.Append("</script>")
Page.ClientScript.RegisterStartupScript(GetType(String), "ViewDetails", JScrip.ToString())
End Sub
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900