Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Javascript conflicts?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Forum LockedJavascript conflicts?

 Post Reply Post Reply
Author
Muskan View Drop Down
Groupie
Groupie


Joined: 14 May 2004
Status: Offline
Points: 40
Post Options Post Options   Thanks (0) Thanks(0)   Quote Muskan Quote  Post ReplyReply Direct Link To This Post Topic: Javascript conflicts?
    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!
Back to Top
Phat View Drop Down
Senior Member
Senior Member


Joined: 23 February 2003
Status: Offline
Points: 386
Post Options Post Options   Thanks (0) Thanks(0)   Quote Phat Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Muskan View Drop Down
Groupie
Groupie


Joined: 14 May 2004
Status: Offline
Points: 40
Post Options Post Options   Thanks (0) Thanks(0)   Quote Muskan Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.