Better ways: 1) abandon window.onload and use:
document.observe('dom:loaded', function() { // my code here }); 2) abandon $('search_form').onsubmit and use: var form = $('search_form'); Element.observe(form, 'submit', function() { // my code here }); === but, if you really wan't to be smart about handling the form submit, you should bind an event listener like this: Element.observe(form, 'submit', handleFormSubmit.bindAsEventListener()); Now you need a function name "handleFormSubmit" with a first event argument parameter, so like this: function handleFormSubmit(e) { } e is now the event "submit" and lots of useful information is now available to you, for example the item that cause the submit event to occur, IE., the button you just clicked. So you would have: function handleFormSubmit(e) { // first things first, stop the event from propagating e.stop(); // get element from event object var elm = e.element(); // determine which button was clicked and call appropriate next code if(elm.readAttribute('value') == 'search') // call some code if(elm.readAttribute('value') == 'update') // call some other code } See if you can get the above working and we can carry on with the rest of it later. By the way, if you aren't using Firefox developer tools like FireBug and the Web Developer toolbar, then you are missing out on some really killer tools. Better get those very first. Karl.. -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.