I have been two days trying to find out how to handle a form submission so that when the user clicks on the "submit" button the prototype Updater is activated but the form is not submitted.
This code is a sample that I found that will display your name as you type it.
Event.observe(window, 'load', init, false);
function init(){
$('greeting-submit').style.display = 'none';
Event.observe('greeting-name', 'keyup', greet, false);
}
function greet(){
var url = 'greeting.php';
var pars = 'greeting-name='+escape($F('greeting-name'));
var target = 'greeting';
var myAjax = new Ajax.Updater(target, url, { method: 'get', parameters: pars});
}
It works great. But I want to show the submit button (easy-just remove the display:none line), and display the message when the submit button is clicked without actually submitting the form. Keyup and onblur may be "cute", but the user expects to see a "Submit" button.
Anybody have any ideas how to do that using Prototype? I can do it in raw Javascript, but I really want to try to learn how to use the Prototype library.