Michael Schuerig
2005-Jul-06 08:11 UTC
[Rails-spinoffs] Autocompletion not working in Konqueror
I''ve just had a look again at the autocompletion demo that Thomas put up at http://script.aculo.us/demos/ajax/autocompleter Unfortunately, in Konqueror (3.4.1) it doesn''t work at all. Not even an error is triggered. It does work nicely in Firefox. How about Safari? I don''t have the time right now to track this down systematically (maybe latter), but just from appearances it looks as if the listeners attached to the text field aren''t doing anything. Michael -- Michael Schuerig Those who call the shots mailto:michael@schuerig.de Are never in the line of fire http://www.schuerig.de/michael/ --Ani DiFranco, Not So Soft
Thomas Fuchs
2005-Jul-06 08:33 UTC
[Rails-spinoffs] Autocompletion not working in Konqueror
Works and tested in Safari, Firefox, IE 6. Thomas Am 06.07.2005 um 14:57 schrieb Michael Schuerig:> > I''ve just had a look again at the autocompletion demo that Thomas > put up > at > > http://script.aculo.us/demos/ajax/autocompleter > > Unfortunately, in Konqueror (3.4.1) it doesn''t work at all. Not > even an > error is triggered. It does work nicely in Firefox. How about Safari? > > I don''t have the time right now to track this down systematically > (maybe > latter), but just from appearances it looks as if the listeners > attached to the text field aren''t doing anything. > > Michael > > -- > Michael Schuerig Those who call the shots > mailto:michael@schuerig.de Are never in the line of fire > http://www.schuerig.de/michael/ --Ani DiFranco, Not So Soft > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >
Michael Schuerig
2005-Jul-07 10:37 UTC
[Rails-spinoffs] Autocompletion not working in Konqueror
On Wednesday 06 July 2005 15:18, Thomas Fuchs wrote:> Works and tested in Safari, Firefox, IE 6.The workaround in Prototype.js for Safari needs to be applied to khtml-based browsers more generally. Patch: http://dev.rubyonrails.com/ticket/1641 Michael -- Michael Schuerig Face reality and stare it down mailto:michael@schuerig.de --Jethro Tull, Silver River Turning http://www.schuerig.de/michael/
Thomas Fuchs
2005-Jul-16 14:18 UTC
[Rails-spinoffs] Autocompletion not working in Konqueror
Hi, a bit late but, I''ve come up with this: // KHTML/Safari: http://developer.apple.com/internet/safari/ faq.html#anchor2 // Gecko: http://developer-test.mozilla.org/en/docs/ Browser_Detection_and_Cross_Browser_Support // Opera: http://www.opera.com/support/search/supsearch.dml?index=570 var Engine = { detect: function() { var UA = navigator.userAgent; this.isKHTML = /Konqueror|Safari|KHTML/.test(UA); this.isGecko = (/Gecko/.test(UA) && !this.isKHTML); this.isOpera = /Opera/.test(UA); this.isIE = (/MSIE/.test(UA) && !this.isOpera); } } Engine.detect(); Note that the Gecko test not on navigator.product because Safari returns "Gecko" too here. :P Can you test this on Konqueror? Only Engine.isKHTML should be true. Thomas Am 07.07.2005 um 17:21 schrieb Michael Schuerig:> On Wednesday 06 July 2005 15:18, Thomas Fuchs wrote: > >> Works and tested in Safari, Firefox, IE 6. >> > > The workaround in Prototype.js for Safari needs to be applied to > khtml-based browsers more generally. Patch: > > http://dev.rubyonrails.com/ticket/1641 > > Michael > > -- > Michael Schuerig Face reality and stare it down > mailto:michael@schuerig.de --Jethro Tull, Silver River Turning > http://www.schuerig.de/michael/ > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >
Michael Schuerig
2005-Jul-16 14:37 UTC
[Rails-spinoffs] Autocompletion not working in Konqueror
On Saturday 16 July 2005 20:34, Thomas Fuchs wrote:> Hi, a bit late but, I''ve come up with this: > > // KHTML/Safari: http://developer.apple.com/internet/safari/ > faq.html#anchor2 > // Gecko: http://developer-test.mozilla.org/en/docs/ > Browser_Detection_and_Cross_Browser_Support > // Opera: http://www.opera.com/support/search/supsearch.dml?index=570 > > var Engine = { > detect: function() { > var UA = navigator.userAgent; > this.isKHTML = /Konqueror|Safari|KHTML/.test(UA); > this.isGecko = (/Gecko/.test(UA) && !this.isKHTML); > this.isOpera = /Opera/.test(UA); > this.isIE = (/MSIE/.test(UA) && !this.isOpera); > } > } > Engine.detect(); > > Note that the Gecko test not on navigator.product because Safari > returns "Gecko" too here. :P > > Can you test this on Konqueror? Only Engine.isKHTML should be true.Works. Thanks. Michael -- Michael Schuerig There is no matrix, mailto:michael@schuerig.de only reality. http://www.schuerig.de/michael/ --Lawrence Fishburn
Michael Schuerig
2005-Aug-19 11:51 UTC
[Rails-spinoffs] Browser sniffing (was: Autocompletion not working in Konqueror)
On Saturday 16 July 2005 20:34, Thomas Fuchs wrote:> Hi, a bit late but, I''ve come up with this: > > // KHTML/Safari: http://developer.apple.com/internet/safari/ > faq.html#anchor2 > // Gecko: http://developer-test.mozilla.org/en/docs/ > Browser_Detection_and_Cross_Browser_Support > // Opera: http://www.opera.com/support/search/supsearch.dml?index=570 > > var Engine = { > detect: function() { > var UA = navigator.userAgent; > this.isKHTML = /Konqueror|Safari|KHTML/.test(UA); > this.isGecko = (/Gecko/.test(UA) && !this.isKHTML); > this.isOpera = /Opera/.test(UA); > this.isIE = (/MSIE/.test(UA) && !this.isOpera); > } > } > Engine.detect();Thomas, has anything become of this? As I wrote back then, the detection works correctly on Konqueror. Michael -- Michael Schuerig They tell you that the darkness mailto:michael@schuerig.de Is a blessing in disguise http://www.schuerig.de/michael/ --Janis Ian, From Me To You
Martin Bialasinski
2005-Aug-20 04:40 UTC
[Rails-spinoffs] Browser sniffing (was: Autocompletion not working in Konqueror)
On 19/08/05, Michael Schuerig <michael@schuerig.de> wrote: I do not know the broader context of this, but I am in favor of feature testing whereever possible. The danger is that old code using this Engine thing excludes browser unnecessarily when they gain previously unavailable features. Testing the user agent is unreliable. Better test for features specific to browsers.> > this.isGecko = (/Gecko/.test(UA) && !this.isKHTML);Is better done by testing for window.pkcs11> > this.isOpera = /Opera/.test(UA);Is better done by testing for window.opera> > this.isIE = (/MSIE/.test(UA) && !this.isOpera);Is better done by using conditional compiles.> this.isKHTML = /Konqueror|Safari|KHTML/.test(UA);Konquerer has document.clientWidth, maybe Safari has it as well? Bye, Martin
Michael Schuerig
2005-Aug-20 05:02 UTC
[Rails-spinoffs] Browser sniffing (was: Autocompletion not working in Konqueror)
On Saturday 20 August 2005 12:06, Martin Bialasinski wrote:> On 19/08/05, Michael Schuerig <michael@schuerig.de> wrote: > > I do not know the broader context of this, but I am in favor of > feature testing whereever possible.The "wherever possible" is the catch. There are cases where it is not possible, notably buggy implementations. The original context was that Safari and Konqueror don''t handle listening for keypress events correctly. For Safari, there is a "sniffing" workaround in prototype.js (Event.observe), Konqueror is left in the cold.> The danger is that old code using > this Engine thing excludes browser unnecessarily when they gain > previously unavailable features.Agreed, but what can be done about it? Sometimes it is possible to check if the bug is present (see below for an example). At other times it is not. Michael StdExt.native_date = Date; // khtml Date copy constructor doesn''t work for dates before 1970-01-01 if (StdExt.isKhtml && (new Date(new Date(1969,1,1)).getFullYear()) == 1970) { Date = function() { if (arguments.length == 0) { return new StdExt.native_date(); } if (arguments.length == 1) { d = arguments[0]; if (d instanceof StdExt.native_date) { return new StdExt.native_date( d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds()); } } return new StdExt.native_date(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]); }; Date.prototype = StdExt.native_date.prototype } -- Michael Schuerig Failures to use one''s frontal lobes mailto:michael@schuerig.de can result in the loss of them. http://www.schuerig.de/michael/ --William H. Calvin
Martin Bialasinski
2005-Aug-20 08:55 UTC
[Rails-spinoffs] Browser sniffing (was: Autocompletion not working in Konqueror)
On 20/08/05, Michael Schuerig <michael@schuerig.de> wrote:> On Saturday 20 August 2005 12:06, Martin Bialasinski wrote:> > I do not know the broader context of this, but I am in favor of > > feature testing whereever possible. > > The "wherever possible" is the catch. There are cases where it is not > possible, notably buggy implementations.I see. But then, I would still not check the user agent string but test for the features I posted. The decision is then to a) assume broken in any newer version of the browser, or b) assume fixed in the next version of the browser. Both have their negative impacts :-( a) Freeing the web developer from greve, but leaving the users in the cold when the browser creator fixes a bug b) Forcing the web developer to update the test, if the browser creator does not fix the bug in the next version> Sometimes it is possible to check > if the bug is present (see below for an example).Neat example. Bye, Martin
I am trying to use the Ajax.Updater function to perform server side validation on a form I have. This works great, but I want the form to submit if the form validates and give the user a message if it doesn''t. I can get it to give the user a message, but then the form always submits. Is there anyway to stop the form from submitting or allow the form to submit based on the results coming back to me? Any help would be appreciated. -- Eric Fleming efleming@gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails-spinoffs/attachments/20050820/454a5ca2/attachment.html
On 8/21/05, Eric Fleming <efleming@gmail.com> wrote:> I am trying to use the Ajax.Updater function to perform server side > validation on a form I have. This works great, but I want the form to > submit if the form validates and give the user a message if it doesn''t. I > can get it to give the user a message, but then the form always submits.If you are calling the validation from onsubmit, returning true(or nothing) submits the form, returning false stops the form being submitted. HTH, Rob. -- Rob Sharp email/jabber: rob@sharp.id.au web: http://sharp.id.au pgp: 0E2C C63B BA04 DEB4 7CC0 84FD 17E3 6AA4 87FB 62DF
I am a newbie and wasn''t aware of the Ajax.Request. Sounds like that is what I need, thanks for the info. On 8/20/05, Nic Schlueter <schlueter@gmail.com> wrote:> > I am sort of perplexed I don''t know a whole lot about the > Ajax.Updater. But I was just reading over the code for the > Ajax.Updater and it looks like that is for updating a container > (correct me if I am wrong). Maybe I just do things the hard way but I > usually just use Ajax.Request (I pass in a function for onComplete and > look at the responseText and act accordingly). If you have any > questions or I could look at your js to see if I can help. > > Here is a URL for the Updater: > http://wiki.script.aculo.us/scriptaculous/show/Ajax.Updater > > Here is a URL for the Request: > http://wiki.script.aculo.us/scriptaculous/show/Ajax.Request > > Nicholas > > On 8/20/05, Eric Fleming <efleming@gmail.com> wrote: > > I am trying to use the Ajax.Updater function to perform server side > > validation on a form I have. This works great, but I want the form to > > submit if the form validates and give the user a message if it doesn''t. > I > > can get it to give the user a message, but then the form always submits. > Is > > there anyway to stop the form from submitting or allow the form to > submit > > based on the results coming back to me? Any help would be appreciated. > > > > -- > > Eric Fleming > > efleming@gmail.com > > > > _______________________________________________ > > Rails-spinoffs mailing list > > Rails-spinoffs@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > > > > > >-- Eric Fleming efleming@gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails-spinoffs/attachments/20050821/45b82b32/attachment.html
Still have a question, if I have my Ajax.Request function in the onsubmit event for the form and I have an onComplete event in the Ajax.Request, how do I return a false if the validation fails. Here is a sample of the code: <script> function doValidation(){ } </script> <form action="someurl" onsubmit="doValidation()" method="post"> </form> On 8/21/05, Eric Fleming <efleming@gmail.com> wrote:> > I am a newbie and wasn''t aware of the Ajax.Request. Sounds like that is > what I need, thanks for the info. > > On 8/20/05, Nic Schlueter < schlueter@gmail.com> wrote: > > > > I am sort of perplexed I don''t know a whole lot about the > > Ajax.Updater. But I was just reading over the code for the > > Ajax.Updater and it looks like that is for updating a container > > (correct me if I am wrong). Maybe I just do things the hard way but I > > usually just use Ajax.Request (I pass in a function for onComplete and > > look at the responseText and act accordingly). If you have any > > questions or I could look at your js to see if I can help. > > > > Here is a URL for the Updater: > > http://wiki.script.aculo.us/scriptaculous/show/Ajax.Updater > > > > Here is a URL for the Request: > > http://wiki.script.aculo.us/scriptaculous/show/Ajax.Request > > > > Nicholas > > > > On 8/20/05, Eric Fleming <efleming@gmail.com> wrote: > > > I am trying to use the Ajax.Updater function to perform server side > > > validation on a form I have. This works great, but I want the form to > > > submit if the form validates and give the user a message if it > > doesn''t. I > > > can get it to give the user a message, but then the form always > > submits. Is > > > there anyway to stop the form from submitting or allow the form to > > submit > > > based on the results coming back to me? Any help would be appreciated. > > > > > > -- > > > Eric Fleming > > > efleming@gmail.com > > > > > > _______________________________________________ > > > Rails-spinoffs mailing list > > > Rails-spinoffs@lists.rubyonrails.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > > > > > > > > > > > > > > -- > Eric Fleming > efleming@gmail.com >-- Eric Fleming efleming@gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails-spinoffs/attachments/20050821/055d35b6/attachment.html
Here''s some pseudo-code for ya: 1) change the onsubmit event to be "return(doValidation());" function doValidation(){ var bValid = true; // perform validation routines // if rules fail, set bValid = false; return(bValid); } On 8/21/05, Eric Fleming <efleming@gmail.com> wrote:> > Still have a question, if I have my Ajax.Request function in the onsubmit > event for the form and I have an onComplete event in the Ajax.Request, how > do I return a false if the validation fails. Here is a sample of the code: > > <script> > function doValidation(){ > > } > </script> > > <form action="someurl" onsubmit="doValidation()" method="post"> > </form> > > > > > On 8/21/05, Eric Fleming <efleming@gmail.com> wrote: > > > > I am a newbie and wasn''t aware of the Ajax.Request. Sounds like that is > > what I need, thanks for the info. > > > > On 8/20/05, Nic Schlueter < schlueter@gmail.com> wrote: > > > > > > I am sort of perplexed I don''t know a whole lot about the > > > Ajax.Updater. But I was just reading over the code for the > > > Ajax.Updater and it looks like that is for updating a container > > > (correct me if I am wrong). Maybe I just do things the hard way but I > > > usually just use Ajax.Request (I pass in a function for onComplete and > > > look at the responseText and act accordingly). If you have any > > > questions or I could look at your js to see if I can help. > > > > > > Here is a URL for the Updater: > > > http://wiki.script.aculo.us/scriptaculous/show/Ajax.Updater > > > > > > Here is a URL for the Request: > > > http://wiki.script.aculo.us/scriptaculous/show/Ajax.Request > > > > > > Nicholas > > > > > > On 8/20/05, Eric Fleming < efleming@gmail.com> wrote: > > > > I am trying to use the Ajax.Updater function to perform server side > > > > validation on a form I have. This works great, but I want the form > > > to > > > > submit if the form validates and give the user a message if it > > > doesn''t. I > > > > can get it to give the user a message, but then the form always > > > submits. Is > > > > there anyway to stop the form from submitting or allow the form to > > > submit > > > > based on the results coming back to me? Any help would be > > > appreciated. > > > > > > > > -- > > > > Eric Fleming > > > > efleming@gmail.com > > > > > > > > _______________________________________________ > > > > Rails-spinoffs mailing list > > > > Rails-spinoffs@lists.rubyonrails.org > > > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > > > > > > > > > > > > > > > > > > > > > > -- > > Eric Fleming > > efleming@gmail.com > > > > > > -- > Eric Fleming > efleming@gmail.com > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails-spinoffs/attachments/20050821/8492ed21/attachment-0001.html
I tried that, but the doValidation function will return true all the time, because it doesn''t wait for the oncomplete event to complete before returning the result. On 8/21/05, Ed C. <defeated2k4@gmail.com> wrote:> > Here''s some pseudo-code for ya: > > 1) change the onsubmit event to be "return(doValidation());" > > function doValidation(){ > var bValid = true; > > // perform validation routines > > // if rules fail, set bValid = false; > > return(bValid); > } > > On 8/21/05, Eric Fleming <efleming@gmail.com> wrote: > > > > Still have a question, if I have my Ajax.Request function in the > > onsubmit event for the form and I have an onComplete event in the > > Ajax.Request, how do I return a false if the validation fails. Here is a > > sample of the code: > > > > <script> > > function doValidation(){ > > > > } > > </script> > > > > <form action="someurl" onsubmit="doValidation()" method="post"> > > </form> > > > > > > > > > > On 8/21/05, Eric Fleming < efleming@gmail.com> wrote: > > > > > > I am a newbie and wasn''t aware of the Ajax.Request. Sounds like that > > > is what I need, thanks for the info. > > > > > > On 8/20/05, Nic Schlueter < schlueter@gmail.com> wrote: > > > > > > > > I am sort of perplexed I don''t know a whole lot about the > > > > Ajax.Updater. But I was just reading over the code for the > > > > Ajax.Updater and it looks like that is for updating a container > > > > (correct me if I am wrong). Maybe I just do things the hard way but > > > > I > > > > usually just use Ajax.Request (I pass in a function for onComplete > > > > and > > > > look at the responseText and act accordingly). If you have any > > > > questions or I could look at your js to see if I can help. > > > > > > > > Here is a URL for the Updater: > > > > http://wiki.script.aculo.us/scriptaculous/show/Ajax.Updater > > > > > > > > Here is a URL for the Request: > > > > http://wiki.script.aculo.us/scriptaculous/show/Ajax.Request > > > > > > > > Nicholas > > > > > > > > On 8/20/05, Eric Fleming < efleming@gmail.com> wrote: > > > > > I am trying to use the Ajax.Updater function to perform server > > > > side > > > > > validation on a form I have. This works great, but I want the form > > > > to > > > > > submit if the form validates and give the user a message if it > > > > doesn''t. I > > > > > can get it to give the user a message, but then the form always > > > > submits. Is > > > > > there anyway to stop the form from submitting or allow the form to > > > > submit > > > > > based on the results coming back to me? Any help would be > > > > appreciated. > > > > > > > > > > -- > > > > > Eric Fleming > > > > > efleming@gmail.com > > > > > > > > > > _______________________________________________ > > > > > Rails-spinoffs mailing list > > > > > Rails-spinoffs@lists.rubyonrails.org > > > > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > Eric Fleming > > > efleming@gmail.com > > > > > > > > > > > -- > > Eric Fleming > > efleming@gmail.com > > > > _______________________________________________ > > Rails-spinoffs mailing list > > Rails-spinoffs@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > > > > > >-- Eric Fleming efleming@gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails-spinoffs/attachments/20050821/98889fa1/attachment.html
Just have it return false all the time then in your onComplete callback if it is successful, submit the form with js. But in my opinion it would be better to put onBlur events on your form elements and validate them as the user is filling the form out. Then you can highlight the fields, display feedback quicker, or do whatever you want to make the WebApp seem more responsive. Nicholas On 8/21/05, Eric Fleming <efleming@gmail.com> wrote:> I tried that, but the doValidation function will return true all the time, > because it doesn''t wait for the oncomplete event to complete before > returning the result. > > > On 8/21/05, Ed C. <defeated2k4@gmail.com> wrote: > > Here''s some pseudo-code for ya: > > > > 1) change the onsubmit event to be "return(doValidation());" > > > > function doValidation(){ > > var bValid = true; > > > > // perform validation routines > > > > // if rules fail, set bValid = false; > > > > return(bValid); > > > > } > > > > > > On 8/21/05, Eric Fleming <efleming@gmail.com > wrote: > > > Still have a question, if I have my Ajax.Request function in the > onsubmit event for the form and I have an onComplete event in the > Ajax.Request, how do I return a false if the validation fails. Here is a > sample of the code: > > > > > > <script> > > > function doValidation(){ > > > > > > } > > > </script> > > > > > > <form action="someurl" onsubmit="doValidation()" method="post"> > > > </form> > > > > > > > > > > > > > > > > > > > > > On 8/21/05, Eric Fleming < efleming@gmail.com> wrote: > > > > I am a newbie and wasn''t aware of the Ajax.Request. Sounds like that > is what I need, thanks for the info. > > > > > > > > > > > > > > > > On 8/20/05, Nic Schlueter < schlueter@gmail.com> wrote: > > > > > I am sort of perplexed I don''t know a whole lot about the > > > > > Ajax.Updater. But I was just reading over the code for the > > > > > Ajax.Updater and it looks like that is for updating a container > > > > > (correct me if I am wrong). Maybe I just do things the hard way but > I > > > > > usually just use Ajax.Request (I pass in a function for onComplete > and > > > > > look at the responseText and act accordingly). If you have any > > > > > questions or I could look at your js to see if I can help. > > > > > > > > > > Here is a URL for the Updater: > > > > > > http://wiki.script.aculo.us/scriptaculous/show/Ajax.Updater > > > > > > > > > > Here is a URL for the Request: > > > > > > http://wiki.script.aculo.us/scriptaculous/show/Ajax.Request > > > > > > > > > > Nicholas > > > > > > > > > > On 8/20/05, Eric Fleming < efleming@gmail.com> wrote: > > > > > > I am trying to use the Ajax.Updater function to perform server > side > > > > > > validation on a form I have. This works great, but I want the > form to > > > > > > submit if the form validates and give the user a message if it > doesn''t. I > > > > > > can get it to give the user a message, but then the form always > submits. Is > > > > > > there anyway to stop the form from submitting or allow the form to > submit > > > > > > based on the results coming back to me? Any help would be > appreciated. > > > > > > > > > > > > -- > > > > > > Eric Fleming > > > > > > efleming@gmail.com > > > > > > > > > > > > _______________________________________________ > > > > > > Rails-spinoffs mailing list > > > > > > Rails-spinoffs@lists.rubyonrails.org > > > > > > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > Eric Fleming > > > > efleming@gmail.com > > > > > > > > > > > > -- > > > > > > Eric Fleming > > > efleming@gmail.com > > > _______________________________________________ > > > Rails-spinoffs mailing list > > > Rails-spinoffs@lists.rubyonrails.org > > > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > > > > > > > > > > > > > > > > -- > > Eric Fleming > efleming@gmail.com > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > >
Martin Bialasinski
2005-Aug-21 10:28 UTC
[Rails-spinoffs] Validation Question - Ajax.Updater
On 21/08/05, Nic Schlueter <schlueter@gmail.com> wrote:> Just have it return false all the time then in your onComplete > callback if it is successful, submit the form with js.The routine should return false, if Ajax is available and true otherwise. Or in prototype.js style: No onsubmit in the <form> tag, but after the form: Event.observe(formId, "submit", doValidation.bindAsEventListener()); and function doValidation(event){ if (ajax is available) { initiate checks Event.stop(event); } }> But in my > opinion it would be better to put onBlur events on your form elements > and validate them as the user is filling the form out. Then you can > highlight the fields, display feedback quicker, or do whatever you > want to make the WebApp seem more responsive.I agree with this. But the event to monitor should be onchange. Well, for check- and radioboxes, it would be onclick. The easiest way to do the right thing is new Form.Element.EventObserver(fieldId, checkroutine); checkroutine will get called with two parameter: the element changed, and the new value. Bye, Martin