janp247
asked on
How do I validate openWYSIWYG in Javascript
How do I validate openWYSIWYG in Javascript
<textarea id="txtDefinition"></textarea>
<script language="JavaScript">
generate_wysiwyg('txtDefinition');
</script>
<SCRIPT LANGUAGE=javascript>
<!--
function Add()
{
var textarea = frmAddGlossary.getElementById('txtDefinition').value;
if ((frmAddGlossary.txtTerm.value == '') || (textarea == '' ))
{
alert( 'You must enter both a Term and Definition.' );
return;
}
frmAddGlossary.action = 'add_glossary_script.asp';
frmAddGlossary.submit();
}
//-->
</SCRIPT>
ASKER
Hi x com,
Hereby the rest of the HTML code.
When I use document instead of the name of the form(frmAddGlossary), it does not see the text in the textarea.
Thanks for your assistance.
Hereby the rest of the HTML code.
When I use document instead of the name of the form(frmAddGlossary), it does not see the text in the textarea.
Thanks for your assistance.
<FORM method="post" id="frmAddGlossary" name="frmAddGlossary">
<INPUT class="inputbox" id="txtTerm" maxLength="60" onBlur="upperCase()" value="<% If Not IsEmpty(vEdit) Then Response.Write Trim(vEdit(1,0)) %>" name="txtTerm" size="100">
<br>
<textarea id="txtDefinition"></textarea>
<script language="JavaScript">
generate_wysiwyg('txtDefinition');
</script>
<br>
<INPUT class="inputsubmit" type="button" id="txtAdd" name="txtAdd" value="ADD TO GLOSSARY" alt="Add" onClick="Add()">
</FORM>
<SCRIPT LANGUAGE=javascript>
<!--
function Add()
{
var textarea = document.getElementById('txtDefinition').value;
if ((frmAddGlossary.txtTerm.value == '') || (textarea == '' ))
{
alert( 'You must enter both a Term and Definition.' );
return;
}
frmAddGlossary.action = 'add_glossary_script.asp';
frmAddGlossary.submit();
}
//-->
</SCRIPT>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I am not getting any errors but it still does not see the text in the textarea to validate if empty or not.
Might to post the code snippet regarding the used library?
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
what is the rendered HTML code for the editor that you're using? Possible post the HTML design/other code snippet?
Try change this line:
var textarea = frmAddGlossary.getElementB
To
var textarea = document.getElementById('t