473,395 Members | 1,521 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Form validation/s fail in Internet Explorer only...

scubak1w1
Hello,

I have a form that works like a charm - as long as you are not using Internet Explorer!

I made a new form (below, a *.php file) to show you how VALIDATION (two 'types') is failing in IE... Neither of the validations work in IE...

I tried to change the type="image" to a very simple type="submit" for the form submittal --- and a heck of a lot more things have been tried...

What am I missing?

I am primarily a scientific data analysis guy, geologist, self taught in all this - shows huh? <wink> - so please assume I am missing the easy stuff <smile>

Thanks in advance...
GREG...

Expand|Select|Wrap|Line Numbers
  1.  
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4.  
  5. <head>
  6.  
  7.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  8.  
  9.     <title>DELETE Page - Test Form - Bloody Internet Explorer</title>
  10.  
  11.     <script src="/SpryValidationTextField.js" type="text/javascript"></script>
  12.     <link href="/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
  13.  
  14.  
  15.     <!-- form related javascript -->
  16.     <script language="javascript" type="application/javascript">
  17.  
  18.         var errorsOnSubmit = function(form)
  19.             {
  20.  
  21.                 var ret = Spry.Widget.Form.validate(form);
  22.  
  23.                 var errorZone= document.getElementById('error_zone');
  24.  
  25.                 if (!ret)
  26.                     {
  27.  
  28.                         errorZone.style.visibility = 'visible';
  29.  
  30.                         errorZone.style.backgroundColor = 'red';
  31.  
  32.                     }
  33.                     else
  34.                     {
  35.  
  36.                         errorZone.style.visibility = 'hidden';
  37.  
  38.                     };
  39.  
  40.                 return ret;
  41.  
  42.             };
  43.  
  44.         //validate the specific (sic) of the incident reporting form contents
  45.         function validate_try_simple_form_ie()
  46.             {
  47.  
  48.                 alert('Specific validation fired...');
  49.  
  50.                 //make sure my name is not used
  51.                 if(document.try_simple_form_ie.txt_full_name.value == 'Greg Cocks')
  52.                     {
  53.                         alert('Don\'t use my name!');
  54.                         document.try_simple_form_ie.txt_full_name.value = "";
  55.                         document.try_simple_form_ie.txt_full_name.focus();
  56.                         return false;
  57.                     };
  58.  
  59.                 //check out OK
  60.                 return true;
  61.  
  62.             };
  63.  
  64.     </script>
  65.  
  66.  
  67. </head>
  68.  
  69. <body>
  70.  
  71.     <h1 style="text-align:center;color:red">
  72.         DELETE Page - Test Form - Bloody Internet Explorer - 22
  73.     </h1>
  74.  
  75.     <p>
  76.         Form functionality that works like a charm in Chrome, Firefox, etc - but the Spry and the 'custom' validation does not work in IE!!
  77.         </p>
  78.  
  79.     <form action="<?php print $_SERVER['PHP_SELF']; ?>" method="post" name="try_simple_form_ie" id="try_simple_form_ie" onsubmit="return errorsOnSubmit(this);" >
  80.  
  81.         <input type="hidden" name="_try_simple_form_ie" value="1" />
  82.  
  83.         <label for="txt_full_name" style="font-weight:bold;font-size:0.8em">
  84.             Enter Full Name:
  85.         </label>
  86.         <br />
  87.         <span id="val_txt_full_name">
  88.             <input type="text" name="txt_full_name" size="25" />
  89.             <span class="textfieldRequiredMsg">
  90.                 A value is required.
  91.               </span>
  92.             <span class="textfieldMinCharsMsg">
  93.                 Minimum number of characters not met.
  94.               </span>
  95.           </span>
  96.         <br />
  97.         <br />
  98.  
  99.         <input
  100.             type="image"
  101.             src="http://bytes.com/images/icon_050_submit_button.png"
  102.             alt="Submit Form Details"
  103.             id="submit_form_details"
  104.             title="Submit The Information"
  105.             onclick="return validate_try_simple_form_ie()"
  106.         />
  107.  
  108.         <p class="clearIt" id="error_zone" style="visibility:hidden">
  109.             ERRORS: There are some ERROR/S in the form, shown in red shading of the field/s. Please scroll up, correct them, and resubmit...
  110.            </p>
  111.  
  112.     </form>
  113.  
  114.     <br />
  115.     <br />
  116.  
  117.     <?php
  118.  
  119.         //see if the form details have been submitted
  120.         if(array_key_exists('_try_simple_form_ie', $_POST))
  121.             {
  122.  
  123.                 print 'Name: '.$_POST['txt_full_name'].'<br />';
  124.  
  125.             };
  126.  
  127.  
  128.     ?>
  129.  
  130.  
  131. <script type="text/javascript">
  132.     var sprytextfield1 = new Spry.Widget.ValidationTextField("val_txt_full_name", "none", {validateOn:["blur", "change"], minChars:5});
  133. </script>
  134. </body>
  135.  
  136. </html>
  137.  
  138.  
Mar 22 '12 #1
1 2772
I popped up the simple version on a public page at http://www.stoller.com/a_test_form_pita_ie.php

Internet Explorer is the issue...

There are two types of validation when you hit submit...

(i) if you have not entered 5 characters in the text box, you should see "ERRORS: There are some ERROR/S in the form, shown in red shading of the field/s. Please scroll up, correct them, and resubmit..."

(ii) if you enter my name as in the text box, 'Greg Cocks', no quotes, it should say not to use my name and clear out the text box...

Cheers!
Mar 22 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: r0adhog | last post by:
First off wanted to that all that replied to my previous questions, you were much help. Had a couple of general questions. Why has everyone suggested not using VB Script on the Client Side? ...
3
by: Tim Tyler | last post by:
The user has come back to my page - and I have session data held in hidden form fields that I want to restore. Getting these values using Javascript works fine in Mozilla Firebird - and the like...
1
by: Ashvin Navare | last post by:
Hi, We want to disable BACK & FORWARD button of the browser so that user is forced to navigate through the menu options provided in the site. The browser used is Internet Explorer only. Please...
3
by: autobest.be | last post by:
Hello, I play recently with javascript and thought this graphical effect could be interesting for those who like it :) http://www.autobest.be/test/flag.htm (err...internet explorer only)
6
by: Drew | last post by:
I've already created a simple method of ensuring that all form feilds are filled out before the form is submitted to an ASP page for records to be added to the data base. (Sorry about the...
3
by: Robert Smith | last post by:
I have a very basic form validation script, which wont work due to XHTML Strict not allowing me to use the name attribute on a form. Here is part of my code: if...
3
by: mr_burns | last post by:
hi, i am using the following code which works well in internet explorer but not in firefox (and perhaps others too): var xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async="false";...
16
by: Hosh | last post by:
I have a form on a webpage and want to use JavaScript validation for the form fields. I have searched the web for form validation scripts and have come up with scripts that only validate...
11
by: ft310 | last post by:
Use Internet Explorer go to http://rhodeisland-aa.org/tester/meetings/index.htm On the left click "and go to meetings" Click any address in the right hand 'location' column. The entire page...
4
by: smartic | last post by:
I'm having problem with this code why i don't know works fine in Internet Explorer only that is my code: <script language="javascript" type="text/javascript"> function AJAX(num){ XMLObject =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.