Print Page | Close Window

Javascript conflicts?

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Rich Text Editor (RTE)
Forum Description: Support forum for the Web Wiz Rich Text Editor (RTE).
URL: https://forums.webwiz.net/forum_posts.asp?TID=17515
Printed Date: 29 March 2026 at 8:42am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Javascript conflicts?
Posted By: Muskan
Subject: Javascript conflicts?
Date Posted: 11 December 2005 at 10:27pm
I use javascript form validation to check that a form-field is not empty when submitted. The script is something like this in the head tag:
 
<script language="JavaScript">
<!-- hide from JavaScript-challenged browsers
function application_accept(form) {
 var missing_fields = new Array();
    var i              = 0;
    var x              = "";
  
    /* check for missing fields */
 
    if (form.subject.value ==''){
  missing_fields = "Title of the Case";
        i = i + 1;
    }

 if (form.txtForm.value == ''){
  missing_fields = "Chief Complaints";
        i = i + 1;
    }

   if (i > 0){

  for (var i=0; i<missing_fields.length; i++){
   var x = x + "\n" + missing_fields;

  }
  alert("The following fields must be completed:\n" + x );
  return(false);
   } 
 
    return(true); /* for application_accept */

}

// done hiding -->
</script>

And calling the fuunction from form like this:
 
<form method="post" action="xyz.asp" name=apply onSubmit="return application_accept(this)">
 
It works perfectly but when I put in the webwiz RTE for any field, the RTE works fine but the form-validation scripts stops working. Seems there is a javascript conflict. Borg or anyone else can help me identify and resolve the issue? I really love the usability that RTE adds but at the same time I can not do away with form validation. Please help!



Replies:
Posted By: Phat
Date Posted: 12 December 2005 at 12:51am
Use the javaScript debugger in FireFox to find out where the problem is. It will at at least give you can idea of where to look.

-------------
http://buildit.sitesell.com/sitebuildithome.html - Get a website that sells


Posted By: Muskan
Date Posted: 12 December 2005 at 12:21pm
Thanks. I actually solved the problem immediately after posting it here. The solution is - add your onsubmit call of original form in the RTE_javascript.asp file around line 168 in this function
 
 
 //get textrea value from RTE and run any original onSubmit events
 textArea.form.onsubmit = function(){
  textArea.value = editor.body.innerHTML;
  for (i in this.originalOnSubmit){
   return application_accept(this); // <--This is what I have added. U have to add your own event here
   return this.originalOnSubmit();
  }
If you have only one field in your form than u can simply replace this line
 
return this.originalOnSubmit();
 
with your return call that u were originally using to validate your form or any other script that was using the onSubmit event. If you have many fields than you will need to add your return statment.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net