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.

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.

                 

               
aneethatAsked:
Who is Participating?
 
JakobAConnect With a Mentor Commented:
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
 
thirdCommented:
we're blind if we can't see the code.
0
 
aneethatAuthor Commented:
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
aneethatAuthor Commented:
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
 
aneethatAuthor Commented:
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
 
JakobACommented:
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
 
aneethatAuthor Commented:
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
 
aneethatAuthor Commented:
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
 
JakobACommented:
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
 
aneethatAuthor Commented:
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
 
aneethatAuthor Commented:
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
 
aneethatAuthor Commented:
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
 
aneethatAuthor Commented:
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
 
aneethatAuthor Commented:
Hi Jakoba,

                  Thank you for your help and support.

0
 
JakobACommented:
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
 
aneethatAuthor Commented:
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
All Courses

From novice to tech pro — start learning today.