Onfocus errors

I am having an issue where when I click on the text box the original text dissapears, and if I click off the textarea and then back to it, all the text dispears. This is on a form that needs to be sumbmitted, so the text needs to display. I tried looking up similar questions, but none of the other accepted solutions worked.

<textarea cols="70%" rows="5" name="step<% Response.Write(i) %>txt"  id="step<% Response.Write(i) %>txt" style="display: none;" onfocus='this.value="";'>NOTES:</textarea>
BertrendyAsked:
Who is Participating?
 
gops1Commented:
Remove this line, if you do not want this to happen

onfocus='this.value="";'
0
 
hernst42Commented:
Try:

onfocus='if (this.value=="NOTES:") this.value="";'

So the field gets only cleared if it contains the default.
0
 
BertrendyAuthor Commented:
When I enter either one of those into the code, nothing changes. The text still disappears when it is first clicked on or when you re-vist the textarea.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
gops1Commented:
Show us what have you done till now
0
 
BertrendyAuthor Commented:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- #include virtual="/masterincludes/intranet-functions.inc" -->
<html>
<head>
<title>
Technical Support
</title>
<!-- #include virtual="/masterincludes/css-js.inc" -->

<script language="JavaScript">
function checkForm() {
      var b = document.getElementsByTagName('select');
      for (i = 0; i < b.length ; i++) {
            if (eval("document.myForm.question" + i + ".value") == "NOT TESTED") {
                  alert("Please COMPLETE step #" + (i + 1) + " to submit.");
                  eval("document.myForm.question" + i + ".focus()");
                  return false;
            }
      }
      document.myForm.submit();
}

function openCalendarWindow(formVar) {
      newWin = window.open("/calendar-popup.asp?formVar=" + formVar,"cal","dependent=yes,width=210,height=210,screenX=200,screenY=300,titlebar=yes");
}

function openWinSmall(pagename) {
      smallWin2=open(pagename,"smallwin2","width=500,height=500,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no");
}

function displayMessage(sel,div) {
    var displayArea = document.getElementById('display');
    if (displayArea) {
        if (sel.selectedIndex == 2) {
            document.getElementById(div).style.display = 'block';
        }
            else if (sel.selectedIndex == 0) {
            document.getElementById(div).style.display = 'none';
        } else {
            //We have to loop
            var i = 0;
            var selField;
            while (selField = document.getElementById('select' + i)) {
                if (selField.selectedIndex == 1) {
                    return;
                }
            }
            document.getElementById(div).style.display = 'none';
        }
    }
}
</script>

</head>
<body>


<%
      checkTitle="Checklist"

       Dim step(13)
       step(0) = "Confirm  incident"
     step(1) = "Confirm  product."
     step(2) = "Confirm has been installed"
     step(3) = "Confirm the Environment"
       step(4) = "Confirm is they have selected Test Mode that user ids have been provided."
       step(5) = "Confirm that a test account has been provided."
       step(6) = "Confirm that the test account can be logged into successfully
       step(7) = "Confirm that the vendor has sent a confirmation email "
       step(8) = "Confirm Form is attached."
       step(9) = "Confirm Form is complete."
       step(10) = "Confirm  client form is attached."
       step(11) = "Confirm  client form is complete."
       step(12) = "Confirm  the location of the button."
       step(13) = "Confirm that a button color has been selected." &_

%>
 
 <span class="normalLgBox" style="margin: 10px;">
      <div class="ms-WPHeader ms-WPTitle">
      </div>
      <div class="normalLgBoxContent" style="border-color: #000000;">
      
      <center>
      <strong><span class="largeText"><% Response.Write(checkTitle) %></span></strong>
      <p>
      <form method="post" name="myForm">
      <table width="80%" cellspacing="" celpadding="5" align="center">
      
      <% if request.form("status") <> "" then %>      
      <tr>
            <td class="Strong" valign="top">Results:</td>
            <td class="Strong" valign="top">
            <%
            dim a
            dim passOrFail
            passOrFail = "<font size=""+1"" color=""green"">PASS</font>"
            for a = 0 to ubound(step)
                if request.form("status") <> "" then
                    if request.form("question" & (a)) = "FAIL" then
                        passOrFail = "<font size=""+1"" color=""red"">FAIL</font>"
                    end if
                end if
            Next
            
            Response.Write(passOrFail)
            %>
            </td>
      </tr>
      <tr>
            <td class="Strong" valign="top">Date:</td>
            <td class="normal" valign="top">
            <script type="text/javascript">
            var d=new Date()
            //var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
            var monthname=new Array("01","02","03","04","05","06","07","08","09","10","11","12")
            //document.write(weekday[d.getUTCDay()] + ", ")
            document.write(monthname[d.getUTCMonth()] + "/")
            document.write(d.getUTCDate() + "/")
            document.write(d.getFullYear() + " ")
            document.write(d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds())
            </script>
            </td>
      </tr>
      <tr>
            <td class="Strong" valign="top">Tested By:</td>
            <td class="normal" valign="top"><%= request.form("submitter") %></td>
      </tr>
      <tr>
            <td colspan="2">&nbsp;</td>
      </tr>
      <% end if %>
      
      <tr>
            <td colspan="2"><div id="display"></div></td>
      </tr>
      <tr>
            <td class="ms-WPHeader ms-WPTitle">PASS / FAIL</td>
            <td class="ms-WPHeader ms-WPTitle" width="80%">Step</td>
      </tr>
      <tr>
            <td colspan="2">&nbsp;</td>
      </tr>
      
      
      <%       
           dim i
           for i = 0 to ubound(step)
      
            if request.form("status") <> "" then
      %>
      <tr>
            <td valign="top" class="strong">
            <!-- RESULTS GO HERE (red if FAIL or INCOMPLETE) -->
            <% if request.form("question" & (i)) = "FAIL" then %>
                  <font color="Red"><%= request.form("question" & (i)) %></font>
            <% end if
            if request.form("question" & (i)) = "N/A" then %>
                  <font color="#FF8800"><%= request.form("question" & (i)) %></font>
            <% end if
            if request.form("question" & (i)) = "PASS" then %>
                  <font color="Green"><%= request.form("question" & (i)) %></font>
            <% end if %>
            </td>
            <td class="normal">
            STEP: <% Response.Write(step(i)) %>
            
            <!-- NOTES GO HERE IF ENTERED -->
            <% if request.form("question" & (i)) = "FAIL" and request.form("step" & (i) & "txt") <> "NOTES:" and request.form("step" & (i) & "txt") <> "" then %>
                  <br><br>
                  <b>NOTES:</b> <%= request.form("step" & (i) & "txt") %>
            <% end if %>
            </td>
      </tr>
      <tr>
            <td colspan="2">&nbsp;</td>
      </tr>
      
      
      <% else %>
      
      <tr>
            <td valign="top" class="strong">
            <select name="question<% Response.Write(i) %>" onChange="displayMessage(this, 'step<% Response.Write(i) %>txt')">
            <option value="NOT TESTED"></option>
            <option value="PASS">PASS</option>
            <option value="FAIL">FAIL</option>
            <option value="N/A">N/A</option>
            </select></td>
            <td class="normal">
            <% Response.Write(step(i)) %><br><br>
            <textarea cols="70%" rows="5" name="step<% Response.Write(i) %>txt"  id="step<% Response.Write(i) %>txt" style="display: none;" onfocus='if (this.value=="NOTES:") this.value="";'>NOTES:</textarea>
            </td>
      </tr>
      <tr>
            <td colspan="2">&nbsp;</td>
      </tr>
      <%
      end if
      Next
      %>
      </table>
      
      <input type="hidden" name="status" value="submitted">
      
      <%
      if request.form("status") <> "submitted" then
      %>      
      <p>
      <b>Submitted By:</b> <input type="text" name="submitter" value="<%= getCookie("nfront-intranet","name") %>" size="40">
      <input type="button" value="Submit" class="button" style="background-color: <%= Application("color2") %>; color: #ffffff; font-weight: bold;" onMouseOver="change('<%= Application("color1") %>');" onMouseOut="change('<%= Application("color2") %>');" onClick="checkForm();">
      <% else %>
      <input type="button" value="BACK" class="button" style="background-color: <%= Application("color2") %>; color: #ffffff; font-weight: bold;" onMouseOver="change('<%= Application("color1") %>');" onMouseOut="change('<%= Application("color2") %>');" onClick="javascript:history.back();">
      <% end if %>
      </form>
      </center>
0
 
BertrendyAuthor Commented:
Ok, so I was just staring at code for too long. I missed deleting a quotation mark when removing the onfocus='this.value="";' - sorry! Your solutions were perfect, I am not.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.