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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wsyiwyg editor script and validator not working together 1

Status
Not open for further replies.

benniesanders

Programmer
Jan 20, 2002
199
US
Greetings,

I know just enough to get into trouble, but I'm using innova studio's wysiwyg editor and a separate form validator. They work great separately but not together.

I'm calling them like this:
Code:
<script javascript src="/administrator/scripts/innovaeditor.js"></script>
<script javascript src="/administrator/gen_validatorv2.js"></script>

If I remove the validator, the editor works properly. By "work" I mean when I submit the form, the text in the editor submits. If I use the validator, the text in the editor is ignored.

Both scripts are very long so I hesitate to post them.

Is there a slick way I can validate the other fields in my form and still use this wysiwyg editor? Many thanks in advance.
 
Call the links like this:
Code:
<script type="text/javascript" src="/administrator/scripts/innovaeditor.js"></script>
<script type="text/javascript" src="/administrator/gen_validatorv2.js"></script>
I don't know if it will solve your problem, but it's certainly more correct that the code you posted.

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
Thanks, Jeff. Even if it doesn't solve the problem, I'd like to do it correctly. If you can think of anything, let me know. I saw an earlier post about two onload events need to be called from the body tag, but I could only find one in the editor js file... Many thanks again.
 
hi Jeff,

I found this code on Experts Exchange and it WORKS, apparently somebody was having the same problem. I have a couple of questions about it, though.

1. How do I make it validate more than one field, and

2. How do I make it go back and focus on the field they forgot after the alert comes up?

MANY THANKS AGAIN!!

Code:
function ValidateForm(myForm) {
  if( document.getElementById( 'TheContent' ).value == '' ) {
    alert( 'Please enter text information' ) ;
    return false ;
  } else {
    return true ;
  }
}
 
Try this little modification out...
Code:
function ValidateForm(myForm) {
  if( document.getElementById( 'TheContent' ).value == '' ) {
    alert( 'Please enter text information' ) ;
    [COLOR=red]document.getElementById( 'TheContent' ).focus();[/color]
    return false ;
  } else {
    return true ;
  }
}
Hope that does what you want.

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
OMYGOSH, yes, that's exactly what I needed. Thank you very much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top