Learn from sources
       Member TEXTAREA in CGIDEV2 / DEMOHTML

 «as400»all
 Content-type: text/html
 X-XSS-Protection: 1;
 
 «!doctype html»
 «HTML»
 «HEAD»«title»Texarea example«/title»
 «meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"»
 «meta name="DOCUMENTCOUNTRYCODE" value="it"/»
 «meta name="DOCUMENTLANGUAGECODE" value="EN"/»
 
 «style TYPE="text/css"»
    «!--
    .title { color: Blue; font-weight: Bold; font-size: 24pt; font-family: souvenir lt bt, verdana, serif; align: center}
    .subtitle { color: blue; font-weight: Bold; font-size: 18pt; font-family: souvenir lt bt, verdana, serif; align: center}
    .reg {font-size: 10pt; font-family: arial, helvetica, helv}
    .mono {font-size: 10pt; font-family: courier}
    .lstupd {font-size: 10pt; color: brown; font-family: verdana,arial, helvetica, helv}
    .bb {font-size: 12pt; color: blue; font-weight: bold; font-family: arial, helvetica, helv}
    .brushr {font-size: 24pt; color: red; font-family: brush script, souvenir lt bt, verdana, arial}
    th {font-size: 10pt; font-family: arial, helvetica, helv}
    td {font-size: 10pt; font-family: arial, helvetica, helv}
    --»
 «/style»
 
 «script language="JavaScript"»
 // carriage return
 var reCR = /\r/
 // line feed
 var reLF = /\n/
 // double quote
 var DQ = /\"/
 //=============================================================
 // TS()   Get a TimeStamp to make the CGI request unique
 //=============================================================
 function TS() {
    RightNow = new Date();
    year=RightNow.getFullYear();
    month=(RightNow.getMonth()+1);
    day=RightNow.getDate();
    hours=RightNow.getHours();
    minutes=RightNow.getMinutes();
    seconds=RightNow.getSeconds();
    TimeStamp="ts"+year+month+day+hours+minutes+seconds;
    return TimeStamp;
 }
 //========================================================
 // Drop carriage return X'0D' and line feed X'25' characters
 //========================================================
 function dropCRLF(data) {
     var i = 0;
     while (i!=-1) {
            i = data.search(reCR)
            if (i!=-1) {
                data =data.replace(reCR, " ")
                }
            i = data.search(reLF)
            if (i!=-1) {
                data =data.replace(reLF, "")
                }
     }
    return data
 }
 //========================================================
 // Replace double quote with its ASCII decimal representation "
 //========================================================
 function replDQuote(datain) {
     var dataout = datain;
     var i = 0;
     while (i!=-1) {
            i = dataout.search(DQ)
            if (i!=-1) {
                dataout =dataout.replace(DQ, """)
                }
     }
    return dataout
 }
 //========================================================
 // Check the texarea input data
 //========================================================
 function chkTextArea() {
    var returnTxtA=false
    var inpTxtA=window.document.myform.mytextarea.value
    var inpTxtA=dropCRLF(window.document.myform.mytextarea.value)
    var inpTxtA=replDQuote(inpTxtA)
    window.document.myform.mytextarea.value=inpTxtA
    var inpTxtAl=inpTxtA.length
    var inpTxtAex=(inpTxtAl-1000)
    if (inpTxtAl«=2)
     alert("you forgot to input your text in the textarea")
    else
    if (inpTxtAl»1000)
     alert("your reference text is too long. Please trim off "
            +  inpTxtAex + " characters")
    else
     returnTxtA=true
    return returnTxtA
 }
 //========================================================
 // Check the input fields of the form
 //========================================================
 function chkMyForm() {
    var answer1 = false;
    answer1=chkTextArea();
    if (answer1==true) {
        window.document.myform.submit();
        return true;
    }
        sbm1Ret=false;
        return sbm1Ret
 }
 «/script»
 «/head»
 
 «table width="600"»
 «tr»«td colspan=2 class=title»
         Textarea example
         «/td»«/tr»
 «tr»«td colspan=2 class=reg»
         Enter the data and press the «b»Send«/b» button
         «form name=myform method=post action="/cgidev2p/textarea.pgm"»
         «script lanuage="JavaScript"»
         document.write("«input type=hidden name=ts value=" + TS() + "»")
         «/script»
         «/td»«tr»
 «tr»«td valign=top class=reg»
         Your opinion about this example:«br»
         (1,000 char max)
         «/td»
     «td valign=top class=reg»
         «textarea name=mytextarea rows="10" cols="25" wrap=hard»/%T1%/«/textarea»
         «/td»«tr»
 «tr»«td colspan=1 class=reg align=center»
         «input type=button onClick="return chkMyForm()"
          value=" Send "»
         «/td»«/tr»
         «/form»
 «tr»«td colspan=2 class=reg align=center»
         «img src="/cgidev/blue.gif" alt="blue line" height=1 width="100%"»«br»
         «a href="/cgidev2p/dspsrc.pgm?cgiinp01=cgidev2&cgiinp02=demohtml&cgiinp03=textarea"
          target="_blank"»source of the external html«/a»«br»
         «a href="/cgidev2p/dspsrc.pgm?cgiinp01=cgidev2&cgiinp02=qrpglesrc&cgiinp03=textarea"
          target="_blank"»source of the CGI«/a»
 «/table»
 
 «br»«br»
 «/body»«/html»
0.020 sec.s