Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Javascript problem to submit a form in Safari or Firefox



Hello all,

 

I have a form on a website that fetches info from a database to populate the dropdown lists, but some dropdown lists are dependent from what was selected from previous dropdowns. To remedy to this, every time one of the important dropdown changes, we force a submit of the form, through _javascript_ event binding, which loads the correct info into the dependent dropdown.

 

This works fine in IE, but not in Firefox or Safari. Curently, we use a .php page that loads an HTML template. That template contains the _javascript_ for the operation. Here's a sample of the code :

 

function page_membersSearch_s_talent_cat_OnChange()
{
    var result;

    document.forms["membersSearch"].submit();

    return result;
}

//
// If element exist than bind function func to element on event.
// Example: check_and_bind('document.NewRecord1.Delete1','onclick',page_NewRecord1_Delete1_OnClick);
//
function check_and_bind(element,event,func) {
  var htmlElement = eval(element);
  if (htmlElement) {
    if (typeof(htmlElement)=="object" && !htmlElement.tagName && htmlElement.length > 0)
    {
      for (var i=0; i < htmlElement.length; i++)
        eval(element+"["+i+'].'+event+'='+func);
    }else eval(element+'.'+event+'='+func);
  }
}


function bind_events() {
    if (document.forms["membersSearch"]) check_and_bind('document.forms["membersSearch"].s_talent_cat','onchange',page_membersSearch_s_talent_cat_OnChange);
    if (document.forms["membersSearch"]) check_and_bind('document.forms["membersSearch"].s_gender_id','onchange',page_membersSearch_s_gender_id_OnChange);
    forms_onload();
}

 

window.>

 

If you could either tell me what is wrong with the code, or give me an alternate solution, I would be extremely grateful.

Thanks in advance

 

Louis Philip Morin

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Web-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/web-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.