• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Validation on IE7

Hi everyone.

I have a form with custom validation. Basically, it makes sure that the name of a group is unique by looking up the name before trying to insert the record (via "callback_XYZ" feature of CI validation). On FF3, it works fine.. but in IE7, it looks like the form is submitting TWICE (with single form submit "click") b/c the record is added on the DB (i made sure the table is empty) and validation comes back saying that the name is taken.

From this my only guess is that IE7 is somehow submitting twice.
IS there a solution to this? It's making me pull my hair out! :/

[eluser]Dan Dar3[/eluser]
Hi Taewoo,

Try starting IE without addons, see if you have the same problem, Start > Run > iexplore.exe -extoff

Check your code, maybe you have a submit button with an onSubmit handler that does submit without returning false?! clearly a shot in the dark :-)


Hi Dan.
Thanks for the insight.
The problem with the addon solution is that i won't be able to guarantee that the user has IE w/o addon. THat's more of a hack solution so I can't use that. The "return false" issue is something i looked already (and it's there).

If anyone's interested, I solved this issue by checking for uniqueness of data by doing ajax check. It's not the hottest solution but shoot, it works!

[eluser]Dan Dar3[/eluser]
Hi Taewoo,

Great you fixed your problem. If you have a webpage from where you inspired for your solution, feel free to post that, others might be interested as well - I know I would give it a quick glance.


Since CI community is so giving, i shall give back. Smile

Controller/method that gets called
function search_club_name($city, $state, $name)
        header('Content-Type: application/json');
        $club_names = $this->club_model->getByClubUrl( $city, $state, $name );
        echo count($club_names);

And the AJAX code

var url = '/ajax/search_club_name/'+  city_string + "/" + state_string + "/" + name_string;
        new Ajax.Request(url, {
              method: 'get',
              onComplete: function(response) {
                  //alert('Complete: ' +  Object.inspect(response.responseText));
                  if(response.responseText == 0) {
                  } else {
                      var msg = 'Club name"' + name_string + '" has been taken for city of '+ city_string +', '+ state_string + '. Please choose a different name/city combination.'  

[eluser]Dan Dar3[/eluser]
On behalf of the community, big thumbs up! :-)

Oops.. one other thing.. IE caches ajax requests. To prevent this..
var url = '/ajax/search_club_name/'+  city_string + "/" + state_string + "/" + name_string + '/' + Math.random();

I was pulling out my hair when I kept seeing old data (even when the table had NO DATA!).

IE's the #1 cause of baldness among developers.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.