Solved

Invalid Pointer javascript error. I call popup window form from the main form call editProject.asp. When i call popup form it says invalid Pointer and could not open my popup. Could give me solution.

Posted on 2004-03-31
16
4,657 Views
Last Modified: 2010-05-18
Hi,

         I have 4 button in my main form (editProject.asp) to call 4 different popup window form.  When i call the popup window form it shows Invalid Pointer and could not able to open the popup form.

I have entered 5 projects. I could able to open the popup form for the other 4 projects, but i face problem only in my 5th project.

It's so confusing for me why i get only in the 5th record what is the reason for it?


Could anyone help me to figure out this problem?

Thank you.

                 

               
0
Comment
Question by:aneethat
  • 11
  • 4
16 Comments
 
LVL 30

Expert Comment

by:third
ID: 10728883
we're blind if we can't see the code.
0
 

Author Comment

by:aneethat
ID: 10729065
Hi,

        This is my code to call the popup form. This below function is call from the popup button to convert form values to session variable.

function MM_openBrWindow(theURL,winName,features) { //v2.0
var k;
var str;

//function newWin() {    
 k=document.f.elements;
 str="?";
// mypage="manpow.asp";
 for (i=0;i<k.length;i++) {
 if (k[i].type=="text") {
 str=str+k[i].name+"="+k[i].value+"&";
}
if (k[i].type=="radio") {
   if (k[i].checked) {
  str=str+k[i].name+"="+k[i].value+"&";
  }
}
if (k[i].type=="checkbox") {
   if (k[i].checked) {
  str=str+k[i].name+"="+k[i].checked+"&";
  }
}
if (k[i].type=="textarea") {
//if (f[i].checked) {
 str=str+k[i].name+"="+k[i].value+"&";
//}
}

      if (k[i].type=="hidden") {
str=str+k[i].name+"="+k[i].value+"&";
//alert(str);
}
  if (f[i].type=="select-one") {
  str=str+f[i].name+"="+f[i].options[f[i].selectedIndex].value+"&";
//  alert(str);
  }
 // if (f[i].type=="select-multiple") {
//for (j=0;j<f[i].options.length;j++) {
 // str=str+f[i].options[j].value+"="+f[i].options[j].selected+"&";
 // }
 // }
 }
 str=str.substr(0,str.length-1);
 // now open the popup
 theURL+=str;
 window.open(theURL,winName,features);
// win=window.open(mypage, 'myname');
}

Response.Write " <INPUT type=button value=Add onClick=MM_openBrWindow('manpow.asp','ProjectApplication','status=yes,scrollbars=yes,resizable=yes,width=800,height=300')>"



Thank you.
0
 
LVL 15

Accepted Solution

by:
JakobA earned 100 total points
ID: 10729178
There are a number of characters that can make trouble when you add them in a url-parameter. To awoid that you should alway use the escape function on the parameter values:
           str=str+k[i].name+"="+ escape( k[i].value )+"&";                 // ADDED escape function

as a forinstance a text field may contain quotemarks  ' (as in O'Niel)  or " (as in:  he said I was "super" pretty)  If such characters do not get escaped javascript can get confused when it tries to use the finished string.

regards JakobA
0
 

Author Comment

by:aneethat
ID: 10729757
Hi Jakoba,

                 Yes, i found problem in my textarea box where the user user html code. Before i click the popup window i take out the text in the textarea box then it works fine i.e. i could able to open my popup form.

If i put it again i could not able to open the popup window. Let me try using escape commend and let you know the result.


Thank you.
0
 

Author Comment

by:aneethat
ID: 10729807
Hi JaKoba,

                    The escape function is not working. Still i am facing the same problem.
i have 3 textarea box the user enter html text in it. if i take text from anyone of the textarea box i could able to open the popup.

           The text in textarea box contains comma, space everything.

How do i get rid of it.

Thank you.
0
 
LVL 15

Expert Comment

by:JakobA
ID: 10730247
The escape function should definitely work. Can you give a link to the page so I can look?

another factor though is the amount of data you want to send. There is a limit of ca 2 kilobyte as the maximum that can be sent with one url.
0
 

Author Comment

by:aneethat
ID: 10738513
Hi jakoba,

                  Still it does not works with escape commend. But the escape comand work and conver the textarea information by putting alert in the javascript function. It converts the space to %20. But in the textbox it miss some information.

even i put,

Response.write "<textarea name='PLExperience' cols='80' rows='10' onChange=""javascript:calculateTotals();"">"&Session(Server.HTMLEncode("PLExperience"))&"</textarea></td>"

I get is problem when i user html tag. My text is here:

<html><body><dd>1. Plan and provide roadmap decide technical strategies of the project</dd><dd>2. Project collaboration between DSI and Seagate MMI and SII</dd><dd>3. In charge of motor system level design</dd><dd>4. In charge of electromagnetic (EM) design</dd><dd>5. In charge of m

I have entered 8 points but gone after this 5th point it disappears.

My javascritp function is like what you have gave me.


function MM_openBrWindow(theURL,winName,features) { //v2.0
var k;
var str;
 k=document.f.elements;
 str="?";

 for (i=0;i<k.length;i++) {
 if (k[i].type=="text") {
 str=str+k[i].name+"="+escape(k[i].value)+"&";
}
if (k[i].type=="textarea") {
 str=str+k[i].name+"="+escape(k[i].value)+"&";

       }

  }
 str=str.substr(0,str.length-1);
 // now open the popup
 theURL+=str;
 window.open(theURL,winName,features);

}


Could you tell me what could be the reason for it.


0
 

Author Comment

by:aneethat
ID: 10738594
Hi Jakoba,

                  It's working fine in my local system. But in the live server (intranet) it gives me the problem.

Is it because of any javascript settings?

Could you please help me in that.

It works fine in my local system, the same code asp files i am using but facing problem in my live server.

Help me?  the user is tragging me.

0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 15

Expert Comment

by:JakobA
ID: 10739574
I am sorry, but I do not think I can help further without seeing the actual code. It appears we are into ASP now rather than clientside JavaScript, and I do not know much about ASP.

regards JakobA

0
 

Author Comment

by:aneethat
ID: 10747294
Hi Jakoba,

                     I am sorry my website is an intranet site. They are using for the Project information.

                    Now i get the problem in my local sytem as well after the user added a new record with the HTML information in 3 textarea boxes. The escape commend conver the space (i.e.) it's working.

                    Once i take out the textarea information and click the button open popup it's working. The problem is in textarea information.

0
 

Author Comment

by:aneethat
ID: 10750853
Hi Jakoba,

                    I got an clue i would like to know is it true.

Is there any limit by passing the value in the querystring. i.e. we pass value in querystring in the javascript function. my textarea information may be more than 250 characters.

Could you please answer for this question?

Thank you.
0
 

Author Comment

by:aneethat
ID: 10754245
Hi Jakoba,

             My page is doing funny. After i take out the text in the first textarea box before i click the popup window it's working, it does not care about the other textarea box with space and html.

Why this is happening?

0
 

Author Comment

by:aneethat
ID: 10754446
Hi jakoba,

                 Yes it's because of the no of characters in the form. For the other 7 projects, it's working fine. I face the problem only in this Project. The have entered in almost all the boxes.

is there anyother way i can solve this problem.

I took one of our group companies website as referenct, i got the same concept from them. But if i cut and paste all information in their form boxes it works. i.e. i could able to open the popup window.

But they are directly call the popup. Not converting to session variable by javascript function.

But they display all the main form information once popup window is closed.

I don't know what method they are using.

Could You please help me?

sorry for my trouble.





Thank you.



0
 

Author Comment

by:aneethat
ID: 10755176
Hi Jakoba,

                  Thank you for your help and support.

0
 
LVL 15

Expert Comment

by:JakobA
ID: 10761451
Sorry for delay. I was a bit busy.

Yes there is a limit to total length of the url and all the parameters. It is somewhere around 2 Kilobytes total. note that the escape function work by expanding the 'illegal' characters each to a 3-character code so the number of illegal characters influence the counting.

anothe way to transfer data to the popup coul be using a 'callback' function in the popup to fetch the data from the page it was opened by.

in the head of your popup page:
<script type='text/javascript'> <!-- //>

var formname = "nameOfYourForm";
var textareaname = "nameOfThePotentiallyHugeTextarea";

function fetchDataFromParentPage() {
    return  opener.document.forms[formname].elements[textareaname].value;   // not need for escaping here
}

// --> </script>

and the body where you vant to use the data you write
    <script type='text/javascript'>  document.write( fetchDataFromParentPage() ); </script>

You probably want to modify that but that is the basic pronciple.

regards JakobA
0
 

Author Comment

by:aneethat
ID: 10762787
Hi Jokoba,

                  Thank you for your help. i posted my query in my asp area and i got the answer for this.

Thank you for your full support. Thank you again.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Problem to Popup 2 51
Scrolling the scrollbar in a list in html 9 31
Phone Dialer 5 36
Asp.net mvc 5 5 19
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now