Solved

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

Posted on 2011-02-20
1
779 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
This article discusses how to implement server side field validation and display customized error messages to the client.
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…
Suggested Courses

636 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