Link to home
Start Free TrialLog in
Avatar of GlobaLevel
GlobaLevelFlag for United States of America

asked on

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

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

ASKER CERTIFIED SOLUTION
Avatar of jondow
jondow
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial