| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
I can say the form is not being submitted, which pointed me to the fact that the event onchange did not get picked up by my _javascript_. The script only forces a submit of the form, and nothing else. Since this doesn't work, Mac users have to manually hit the submit button, which reloads the page with the updated dropdown. I'm keenly aware that this isn't the best solution, and thank you for pointing to me an alternative. Though I'm not familiar with AJAX, I guess I'll take a look at it. Any pointers on a good exemple of what I would need? I'll be doing my own research of course, but it would still help.
Here's the code, hope it comes through :
function forms_onload()
{
var forms = document.forms;
var i, j, elm, form;
for(i = 0; i < forms.length; i++)
{
form = forms[i];
if (typeof(form.onLoad) == "function") form.onLoad();
for (j = 0; j < form.elements.length; j++)
{
elm = form.elements[j];
if (typeof(elm.onLoad) == "function") elm.onLoad();
}
}
return true;
}
//
// 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 page_membersSearch_s_talent_cat_OnChange()
{
var result;
document.forms["membersSearch"].submit();
return result;
}
function bind_events() {
if (document.forms["membersSearch"]) check_and_bind('document.forms["membersSearch"].s_talent_cat','onchange',page_membersSearch_s_talent_cat_OnChange);
forms_onload();
}
window.>
Thanks for taking the time to read this!
Louis Philip Morin
From: Niels Meersschaert <email@hidden>
To: email@hidden
Subject: Re: _javascript_ problem to submit a form in Safari or Firefox
Date: Mon, 20 Mar 2006 08:28:36 -0500
Without details of the code, it's hard to tell what the issue is. However, can you confirm the form is actually being submitted under Safari & Firefox? It seems from your description that the php script then sends a different form (with updated dropdowns) based on the value of the source dropdown. You might want to consider doing this differently as that's an expensive operation, reloading the entire form to change one dropdown. AJAX would let you update the target dropdown when your source dropdown changes, without an entire page load. It's usually much faster.
Niels
On Mar 19, 2006, at 11:07 PM, Louis Philip Morin wrote:
>Hello all,
>
>I have a form on my website on which some dropdowns data depend on
>previous dropdowns on the same form. Right now the way it's
>handled, when one of the important dropdowns change, a _javascript_
>event get's ticked and submits the form, which when reloading loads
>the right info in the other dropdowns. My main problem is that this
>event handling doesn't seem to work with Safari or Firefox. I tried
>sending a sample of the code to this dev-list, but it didn't come
>through, which is why I'm sending this one without code.
>
>I'm also conscious this might not be the best way to handle this,
>so if you have another option to give me I'd be glad anyhow.
>
>Currently the page is a .php that loads an html template in which
>the _javascript_ is located.
_______________________________________________
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
_______________________________________________ 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
| References: | |
| >Re: Javascript problem to submit a form in Safari or Firefox (From: Niels Meersschaert <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
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.