Solved

get data to server side code for use in methods and session varaibles....

Posted on 2011-02-20
1
772 Views
Last Modified: 2012-05-11
I am using the following code...once the user hits the go button the data that the user inputs has to be taken to serside functions and session variables...if I use httpcurrent context..or web method with a script manage I get the following error...

Cannot refer to an instance meember of a class from within a shared method or shared memeber intializer without an explicit  instnace of the class.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<HTML>
<HEAD>
<SCRIPT LANGUAGE=JAVASCRIPT>

function hide_controls(){

document.getElementById("textarea2").style.display = "none";
document.getElementById("text2").style.display = "none";
document.getElementById("label2").style.display = "none";

document.getElementById("textarea3").style.display = "none";
document.getElementById("text3").style.display = "none";
document.getElementById("label3").style.display = "none";

document.getElementById("textarea4").style.display = "none";
document.getElementById("text4").style.display = "none";
document.getElementById("label4").style.display = "none";

document.getElementById("textarea5").style.display = "none";
document.getElementById("text5").style.display = "none";
document.getElementById("label5").style.display = "none";

document.getElementById("label6").style.display = "none";


}

function countChars(){
     var theForm = document.forms[0];
     var textLength = theForm.textarea1.value.length;     
     var adjustedLength =  textLength;
     var returnValue;
     
    if (adjustedLength >= 150){
     
        document.getElementById("textarea2").style.display = "";     
        document.getElementById("text2").style.display = "";
        document.getElementById("label2").style.display = "";
        document.getElementById("textarea2").focus(); 
        alert("You are limited to 149 characters for each field. It will spill over into another field when the SMS is sent.");
       return true;  
    }     

     theForm.text1.value = adjustedLength;
}


function countChars_2(){
    var theForm2 = document.forms[0];
     var textLength2 = theForm2.textarea2.value.length;     
     var adjustedLength2 =  textLength2;
     var returnValue;
     
    if (adjustedLength2 >= 150){
     
        document.getElementById("textarea3").style.display = "";     
        document.getElementById("text3").style.display = "";
        document.getElementById("label3").style.display = "";
        document.getElementById("textarea3").focus(); 
        alert("You are limited to 149 characters for each field. It will spill over into another field when the SMS is sent.");
        return true;
    }     

     theForm2.text2.value = adjustedLength2;
}

function countChars_3(){
    var theForm2 = document.forms[0];
     var textLength2 = theForm2.textarea3.value.length;     
     var adjustedLength2 =  textLength2;
     var returnValue;
     
    if (adjustedLength2 >= 150){
     
        document.getElementById("textarea4").style.display = "";     
        document.getElementById("text4").style.display = "";
        document.getElementById("label4").style.display = "";
        document.getElementById("textarea4").focus(); 
        alert("You are limited to 149 characters for each field. It will spill over into another field when the SMS is sent.");
        return true;
    }     

     theForm2.text3.value = adjustedLength2;
}

function countChars_4(){
    var theForm2 = document.forms[0];
     var textLength2 = theForm2.textarea4.value.length;     
     var adjustedLength2 =  textLength2;
     var returnValue;
     
    if (adjustedLength2 >= 150){
     
        document.getElementById("textarea5").style.display = "";     
        document.getElementById("text5").style.display = "";
        document.getElementById("label5").style.display = "";
        document.getElementById("textarea5").focus(); 
        alert("You are limited to 149 characters for each field. It will spill over into another field when the SMS is sent.");
        return true;
    }     

     theForm2.text4.value = adjustedLength2;
}

function countChars_5(){
    var theForm2 = document.forms[0];
     var textLength2 = theForm2.textarea5.value.length;     
     var adjustedLength2 =  textLength2;
     var returnValue;
     
    if (adjustedLength2 >= 150){
     
        alert("You have reached the limitations of the system.");
        return true;
    }     

     theForm2.text5.value = adjustedLength2;
}





</SCRIPT>
</HEAD>
<body onLoad="hide_controls()">
    <form id="form1" runat="server">
      <TEXTAREA onKeyUp="javascript:countChars();" id="textarea1" name="textarea1" rows=7 cols=43></TEXTAREA><br />
      No. of characters:&nbsp; <INPUT id=text1 name=text1 style="borderWidth:0;border:none;" size=5 value=0 readonly><asp:Label ID="Label6"  runat="server" Text="Max # of chars per field is 149"></asp:Label>
      <BR> <BR>    
      <TEXTAREA onKeyUp="javascript:countChars_2();" id="textarea2" name="textarea2" rows=7 cols=43></TEXTAREA><BR>
       <asp:Label ID="Label2"  runat="server" Text="No. of characters:"></asp:Label>&nbsp; <INPUT id=text2 name=text2 style="borderWidth:0;border:none;" size=5 value=0 readonly>
      <BR> <BR>
      <TEXTAREA onKeyUp="javascript:countChars_3();" id="textarea3" name="textarea3" rows=7 cols=43></TEXTAREA><BR>
      <asp:Label ID="Label3"  runat="server" Text="No. of characters:"></asp:Label>&nbsp; <INPUT id=text3 name=text3 style="borderWidth:0;border:none;" size=5 value=0 readonly>
      <BR> <BR>
      <TEXTAREA onKeyUp="javascript:countChars_4();" id="textarea4" name="textarea4" rows=7 cols=43></TEXTAREA><BR>
      <asp:Label ID="Label4"  runat="server" Text="No. of characters:"></asp:Label>&nbsp;  <INPUT id=text4 name=text4 style="borderWidth:0;border:none;" size=5 value=0 readonly>
      <BR> <BR>
      <TEXTAREA onKeyUp="javascript:countChars_5();" id="textarea5" name="textarea5" rows=7 cols=43></TEXTAREA><BR>
       <asp:Label ID="Label5"  runat="server" Text="No. of characters:"></asp:Label>&nbsp; <INPUT id=text5 name=text5 style="borderWidth:0;border:none;" size=5 value=0 readonly>
    </form>
</BODY>
</HTML>

Open in new window

0
Comment
Question by:GlobaLevel
1 Comment
 
LVL 2

Accepted Solution

by:
jondow earned 500 total points
ID: 34941215
Hi, can you post you code behind / class file?

Rick
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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'…
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
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…

863 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

21 Experts available now in Live!

Get 1:1 Help Now