Results 1 to 19 of 19

Thread: replacing "alert" with a textbox

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    447

    replacing "alert" with a textbox

    I wanted to merge 2 textboxes into 1. I put <%%> tags on the original additional textbox and its submit button. Instead I added a textbox id="t1" under the "reset".

    I'm stuck on replacing the former "alert" in javascript with the "t1" textbox. There's no error showing but the textbox "t1" doesn't function.

    Here's the link:
    http://k.domaindlx.com/gemetria/gemetria3.asp
    Code:
    <%
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
     <head>
      <title></title>
      <meta name="description" content="" />
      <meta name="keywords" content="" />
      <meta http-equiv="Content-Type" content="text/html; UTF-8" />
      <meta name="author" content="" />
      <script type="text/javascript">
      //<![CDATA[
       //&&& 1st of 2 instances of getKeyValue(). changed name of Fx, '_h' for hebrew? 
       function getKeyValue_h(chr) { 
       //A switch statement is more efficient for this
        switch(chr.charAt()){
         case "A": return 1; 
         case "B": return 2; 
         case "G": return 3; 
         case "D": return 4; 
         case "H": return 5; 
         case "V": return 6; 
         case "X": return 8; 
         case "+": return 9; 
         case "Y": return 10; 
         case "k":;
         case "K": return 20; 
         case "L": return 30; 
         case "m":;
         case "M": return 40; 
         case "n":;
         case "N": return 50; 
         case "$": return 60; 
         case "O": return 70; 
         case "p":;
         case "P": return 80; 
         case "c":;
         case "C": return 90; 
         case "q": return 100; 
         case "R": return 200; 
         case "S": return 300; 
         case "T": return 400;
         default: return 0; 
        }
       } 
    
       function computeValue(str) { 
        var ans = 0; 
        for(var i = 0; i < str.length; i++) { 
         ans += getKeyValue_h(str.charAt(i));
        } 
        return ans; 
       }
    function Process(){
      var frm = document.getElementById("form1");
      var x = Number(frm.hOutput.value);
      var remainder = (x % 22);
      if (remainder==0) {remainder=22;}
      alert("( " + x + " % 22 ) = SPOKE " + remainder) 
    }
        //]]>
      </script>
      <style type="text/css">
      /*<![CDATA[*/
       textarea{font-family:BSTHebrew}
      /*]]>*/
      </style>
     </head>
     <body>
    <body>
    <%'<form id="form1" action="" onsubmit="">
    'Enter a number to determine which SPOKE it belongs to:
    '	<input type="text" name="t1"/>
    '	<input type="button" value="SPOKE" onclick="Process()"/>
    '</form>%>
      <form id="form1" action="javascript:void(0)">
       <div>
        <br>
        <textarea          name="hInput"  id="hInput"  onkeyup="hOutput.value = computeValue(hInput.value, 'h');" rows="9" cols="64" class="onLoad"></textarea><br />
        <input type="reset" value="Clear" name="B2" />
        <input type="text" name="hOutput" id="hOutput" onkeyup="t1.value = Process()" class="onLoad"/>
        <input type="text" name="t1" id="t1" readonly="true"/>
       </div>
      </form>
     </body>
    </html>
    Compare bible texts (and other tools):
    TheWheelofGod

  2. #2
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 2000
    Location
    NJ
    Posts
    602

    Re: replacing "alert" with a textbox

    Have you tried removing readonly="true"?
    Chris

    VB 6.0 Calendar App Video Gamers Group
    Don't forget to rate people if they helped you.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    447

    Re: replacing "alert" with a textbox

    Yes I tried and didn't work. But isn't there supposed to be a javascript function to imediately show the result in the 2nd textbox?
    Compare bible texts (and other tools):
    TheWheelofGod

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: replacing "alert" with a textbox

    PHP Code:
    document.formname.textbox2name.value //the value 

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    447

    Re: replacing "alert" with a textbox

    Code:
    document.formname.textbox2name.value = //the value
    SO I take it that this goes in JavaScript replacing the "alert" right?
    Compare bible texts (and other tools):
    TheWheelofGod

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: replacing "alert" with a textbox

    Well, you'd use it to place a value into your second textbox.

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    447

    Re: replacing "alert" with a textbox

    Code:
    function Process(){
      var frm = document.getElementById("form1");
      var x = Number(frm.hOutput.value);
      var remainder = (x % 22);
      if (remainder==0) {remainder=22;}
    document.form1.t1.value = "( " + x + " % 22 ) = SPOKE " + remainder; 
    }    //]]>
    I must be doing something wrong. It Doesn't work.

    Code:
    <span DIR=rtl><textarea          name="hInput"  id="hInput"  onkeyup="hOutput.value = computeValue(hInput.value, 'h');" rows="9" cols="64" class="onLoad">
    </textarea></span><br />
        <input type="reset" value="Clear" name="B2" />
        <input type="text" name="hOutput" id="hOutput" onkeyup="t1.value = Process()" class="onLoad"/>
        <input type="text" name="t1" id="t1"/>
        <input type="submit" value=" Search "/>
    Compare bible texts (and other tools):
    TheWheelofGod

  8. #8
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: replacing "alert" with a textbox

    Odd, at first glance it seems OK.

    Code:
    function Process(){
      var frm = document.getElementById("form1");
      var x = Number(frm.hOutput.value);
      var remainder = (x % 22);
      if(remainder==0) {
        remainder=22;
           }
    frm.t1.value = 'testing';
    }
    Does testing show up at all? Is this on the URL you specified?

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    447

    Re: replacing "alert" with a textbox

    Ok since it is found on the "response" page go to URL:
    http://k.domaindlx.com/gemetria/kjv.asp

    TO make it easy to get there go to the textbox where it says "select a checkbox below to enable".

    Check "book" and type 1 in the textbox to search for book '1'.

    Then You find the textarea with two textoxes.

    WHen you type, to make it easy use capital letters in the textarea.
    You'll notice "BRASYT" will show 912 but the textbox next to it stays empty.

    Here's the script:
    Code:
      //<![CDATA[
       //&&& 1st of 2 instances of getKeyValue(). changed name of Fx, '_h' for hebrew? 
       function getKeyValue_h(chr) { 
       //A switch statement is more efficient for this
        switch(chr.charAt()){
         case "A": return 1; 
         case "B": return 2; 
         case "G": return 3; 
         case "D": return 4; 
         case "H": return 5; 
         case "V": return 6; 
         case "X": return 8; 
         case "+": return 9; 
         case "Y": return 10; 
         case "k":;
         case "K": return 20; 
         case "L": return 30; 
         case "m":;
         case "M": return 40; 
         case "n":;
         case "N": return 50; 
         case "$": return 60; 
         case "O": return 70; 
         case "p":;
         case "P": return 80; 
         case "c":;
         case "C": return 90; 
         case "q": return 100; 
         case "R": return 200;
         case "s":; 
         case "S": return 300; 
         case "T": return 400;
         default: return 0; 
        }
       } 
    
       function computeValue(str) { 
        var ans = 0; 
        for(var i = 0; i < str.length; i++) { 
         ans += getKeyValue_h(str.charAt(i));
        } 
        return ans; 
       }
    function Process(){
      var frm = document.getElementById("form1");
      var x = Number(frm.hOutput.value);
      var remainder = (x % 22);
      if(remainder==0) {
        remainder=22;
           }
    frm.t1.value = 'testing';
    }    //]]>
    Compare bible texts (and other tools):
    TheWheelofGod

  10. #10
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: replacing "alert" with a textbox

    Dude, EOF/BOF error.

  11. #11

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    447

    Re: replacing "alert" with a textbox

    If you got this:
    SELECT * FROM 2 WHERE book LIKE '1' ORDER BY id ASC

    Microsoft OLE DB Provider for ODBC Drivers error '80040e10'

    [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

    /gemetria/kjvresp5.asp, line 212
    then refresh

    End if
    Compare bible texts (and other tools):
    TheWheelofGod

  12. #12
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: replacing "alert" with a textbox

    This is the message:

    SELECT * FROM 2 WHERE text_data LIKE '%1%' AND text_data LIKE '%1%' AND book LIKE '' ORDER BY id ASC

    ADODB.Recordset error '800a0bcd'

    Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

    /gemetria/kjvresp5.asp, line 215
    2 obviously isn't supposed to be the tablename, is it?

  13. #13

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    447

    Re: replacing "alert" with a textbox

    It doesn't work because the text_data LIKE '%1%' is for text. You don't have to put any word there though.
    Compare bible texts (and other tools):
    TheWheelofGod

  14. #14

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    447

    Re: replacing "alert" with a textbox

    I just notice that when:

    1. I write in the textarea the first textbox gives the sum of the numerical value of each letter automatically but the second textbox doesn't pick up the sum (the purpose of the 2nd textbox is to divide the sum of the 1st textbox and give the remainder).

    2. I type any key in the 1st textbox it says "undefined".

    So I think there are a few things:
    1. the 2nd textbox doesn't pick up automatically from the first;
    2. there is a defintition missing.
    Compare bible texts (and other tools):
    TheWheelofGod

  15. #15
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: replacing "alert" with a textbox

    I just can't get past that page you linked to. I feel like an obsessed, forlorn lover now.

  16. #16

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    447

    Re: replacing "alert" with a textbox

    Compare bible texts (and other tools):
    TheWheelofGod

  17. #17
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: replacing "alert" with a textbox

    I think I got it.

    Change this:

    Code:
     <input type="text" name="hOutput" id="hOutput" onkeyup="t1.value = Process()" class="onLoad"/>
    to this:

    Code:
     <input type="text" name="hOutput" id="hOutput" onChange="t1.value = Process();" class="onLoad"/>
    Is that what you wanted?

  18. #18

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    447

    Re: replacing "alert" with a textbox

    textbox 1 isn't transferring to textbox 2.
    Textbox 2 no longer says undefined when I type in textbox 1 though (I think that's a good sign).
    This should resemble to a combo listbox, where you select from the 1st listbox a list appears in the 2nd and after that selection then the 3rd. Except they are 1 textarea and 2 textboxes.

    Is this ok though?
    Code:
    function Process(){
      var frm = document.getElementById("form1");
      var x = Number(frm.hOutput.value);
      var remainder = (x % 22);
      if(remainder==0) {
        remainder=22;
           }
    frm.t1.value = 'testing';
    }
    Compare bible texts (and other tools):
    TheWheelofGod

  19. #19
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: replacing "alert" with a textbox

    Apparently the onChange event isn't being fired.

    use this:

    Code:
    function Process(){
      var frm = document.getElementById("form1");
      var x = Number(frm.hOutput.value);
      var remainder = (x % 22);
      if(remainder==0) 
      {
        remainder=22;
      }
    
    return remainder;
    	
    
    }
    Code:
    <span dir="rtl"><textarea name="hInput" id="hInput" onkeyup="hOutput.value = computeValue(hInput.value, 'h'); t1.value=Process();" rows="9" cols="64" class="onLoad" title="An easy way to paste some text from the list below, select the text, drag it to this text area and then press SHIFT"></textarea></span><br>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width