Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validation check for whitespace returns 'expected object' error

Status
Not open for further replies.

Coder7

Programmer
Joined
Oct 29, 2002
Messages
224
Location
US
Perhaps you could assist me w/some - I think I need other eyes to look at this at this point. The error is on the line 'if ( ( glAction = "E") && ( isWhiteSpace(document.frmCommentsAVED.txtCommentText.value) ) ).

Error: expected object

Below I've listed my form tag, the table section for the text field that I'm validating, the table section for the submit button and the clientside validatation javascript.

First I list all database rows that match a key. I chose the 'edit' option on one row which contains data in txtCommentText. I space out the data in that field and click on Confirm Edit and I get the error.

Thanks for anything that you can contribute!

<% Sub subDisplayForm() %>
<form method=&quot;post&quot; name=&quot;frmCommentsAVED&quot; id=&quot;frmCommentsAVED&quot; action=&quot;&quot; LANGUAGE=&quot;javascript&quot; onsubmit=&quot;return ValidateFields()&quot;>
------------------------------

<tr valign=&quot;top&quot;>
<td align=&quot;left&quot;>
<strong>Comment :</strong>
</td>
<td align=&quot;left&quot;>
<% if glAction = &quot;E&quot; then %>
<input type=&quot;text&quot; name=&quot;txtCommentText&quot; id=&quot;txtCommentText&quot; value=&quot;<%=strCommentText%>&quot;
size=&quot;30&quot; maxlength=&quot;1000&quot; class=&quot;toUpper&quot;>
<% else %>
<strong><%=strCommentText%></strong>
<% end if %> &nbsp;&nbsp;
</td>
</tr>
----------------------------
<% If glAction = &quot;E&quot; Then %>
<input type=&quot;submit&quot; name=&quot;sbmSave&quot; id=&quot;sbmSave&quot; value=&quot;Confirm Edit&quot; style=&quot;BACKGROUND-COLOR: teal; COLOR: white; FONT-SIZE: smallest; FONT-WEIGHT: bold; WIDTH: 160px&quot; >
<% elseif glAction = &quot;D&quot; Then %>
<input type=&quot;submit&quot; name=&quot;sbmSave&quot; id=&quot;sbmSave&quot; value=&quot;Confirm Delete&quot; style=&quot;BACKGROUND-COLOR: teal; COLOR: white; FONT-SIZE: smallest; FONT-WEIGHT: bold; WIDTH: 160px&quot; >
<% End If %>
----------------------------
function ValidateFields()
{ //for Edit, verify that comment text has been entered
if ( ( glAction = &quot;E&quot;) && ( isWhiteSpace(document.frmCommentsAVED.txtCommentText.value) ) )
{
alert(&quot;Comment is a required field.&quot;) ;
document.frmCommentsAVED.txtCommentText.focus() ;
return false ;
}
else
{
document.frmCommentsAVED.sAction.value = lAction+&quot;SAVE&quot; ;
return true ;
}
}
 
I think your error comes from this : if ( ( glAction = &quot;E&quot;) && ... : this is an valuation, not a test. test operator is &quot;==&quot; in jscript. Water is not bad as long as it stays out human body ;-)
 
Thank you very much!! That was it. Have a great day.
 
gimme, gimme, gimme a star after midnight (from ABBA) Water is not bad as long as it stays out human body ;-)
 
[medal]


In lieu of a star...thx again!
 
Is this medal in chocolate ? LOL LOL LOL Water is not bad as long as it stays out human body ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top