[Proto-Scripty] onChange event fire programatically
Hi, I have simple select box select id=myCars option value=volvoVolvo/option option value=audiAudi/option /select and my Javascript $('myCars').observe('change', doSomething); function doSomething(){ alert('doSomething'); } In My code I want to programatically select audi... for which i do $('myCars').value=audi; // also tried other options like making options selection true This changes the selection in UI but doesn't trigger the onChange event. How can I fire the on change event programatically. Thanks and Regards Hari -- 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-scriptacul...@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.
Re: [Proto-Scripty] onChange event fire programatically
The change event is triggered by the field receiving focus, changing value from whatever the defaultValue was, and then losing focus. Maybe you could step through those events within the function that's currently only changing the picker. Or use a synthetic event, and have onchange on the picker set to fire it along with your change function. Then you only need one piece of code to observe the synthetic event. document.observe('my:event',function(){ /*do something here*/ }); select id=myCars onchange=$(this).fire('my:event'); function foo(){ $('myCars').setValue('audi').fire('my:event'); } Walter On Jun 23, 2010, at 8:24 AM, Hari wrote: Hi, I have simple select box select id=myCars option value=volvoVolvo/option option value=audiAudi/option /select and my Javascript $('myCars').observe('change', doSomething); function doSomething(){ alert('doSomething'); } In My code I want to programatically select audi... for which i do $('myCars').value=audi; // also tried other options like making options selection true This changes the selection in UI but doesn't trigger the onChange event. How can I fire the on change event programatically. Thanks and Regards Hari -- 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 . -- 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-scriptacul...@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.
[Proto-Scripty] Re: Proper error handling
I also have a similar method, but I use an Ajax responders to check the error flag and divert the processing to an alternative function when it is set. Since there is no Ajax.Responder for onSuccess, I use onCreate to wrap the error management code around the provided onSuccess option. I once considered returning a custom HTTP status code and using either onError or on5xx (where 5xx is the custom status code for my errors). I am curious if someone tried this, to know if it was a good choice or not. Eric On Jun 23, 4:24 am, joe t. thooke...@gmail.com wrote: Oh thank god. i thought i was being incredibly dense using a solution like that. But having seen no other way to determine the procedural path to take when the server responds (barring a transport error), that seems the most effective way to follow one route for successes and another for failures/errors. Would be interested in seeing some tips for that wrapper magic. ;) -joe t. On Jun 22, 2:45 am, T.J. Crowder t...@crowdersoftware.com wrote: Hi, On Jun 21, 9:58 pm, Jason 'XenoPhage' Frisvoldxenoph...@godshell.com wrote: [snip] What about a non-HTTP error? What if, for instance, myId was invalid? What is the proper way to pass that information back to the ajax application? Is it ok to use a custom 4xx error? Or should I be using JSON or XML to handle this? The answer is in the question. :-) If it's a non-HTTP error, it wouldn't be best practice to use an HTTP error code to represent the error. (Not that HTTP status codes don't have a fair bit of scope creep in them already.) I've standardized by having *all* of my Ajax calls return data in the same way. They all return JSON-formatted data, and the format for success is always: { success: true, otherdata: here } and the format for errors is always: { success: false, errMessage: error message here } In any given application, I tend to have a wrapper around Prototype's ajax stuff with some problem-domain logic in it. That wrapper always checks for the `success` flag on calls and routes to the error handler if it's not there. FWIW, -- T.J. Crowder Independent Software Consultant tj / crowder software / comwww.crowdersoftware.com -- 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-scriptacul...@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.
[Proto-Scripty] extjs + prototype + myCalendar
I am using extjs with prototype. I am using the calendar for extjs located here: http://www.feyasoft.com/myCalendar?tab=download The calendar works just fine without the prototype adapter. When I use it with prototype I get this error in Firefox: [Exception... Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIXMLHttpRequest.send] nsresult: 0x80004005 (NS_ERROR_FAILURE) location: JS frame :: http:///prototype.js :: anonymous :: line 1421 data: no] This happens whenever an ajax request is made. I have tried prototype 1.6 and 1.6.1. Where it occurs in prototype is line 1421 this.transport.send(this.body); Where this.body is userId=1 Any suggestions? -- 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-scriptacul...@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.
[Proto-Scripty] Issues with IE8, mousedown, mouseup -
Hi- I have a search widget class written in prototype that's been running fine for a couple of years now in FF and IE6+7. The user enters search parms, clicks a button and an ajax interaction (using jboss seam) retrieves data from a host server class (Java). The results are populated into a div and rendered using Element.show. The search widget is flexible enough to be used in multiple pages. The button event fired is onmousedown. The problem I am having with IE8 is that the mouseup event is being invoke and reloading the form (which contains the search widget). If I keep the button pressed down, the results display fine. Once I let the button go (mouseup) my form is reloaded. I've tried intercepting the mouseup event but it only nullifies the mousedown. I'm using the latest prototype.js (1.7x and have tried multiple versions). Any ideas? many thanks Max -- 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-scriptacul...@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.
Re: [Proto-Scripty] Re: Proper error handling
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Jun 22, 2010, at 2:45 AM, T.J. Crowder wrote: The answer is in the question. :-) If it's a non-HTTP error, it wouldn't be best practice to use an HTTP error code to represent the error. (Not that HTTP status codes don't have a fair bit of scope creep in them already.) That's what I figured, but I wanted to make sure I was on the right track ... I've standardized by having *all* of my Ajax calls return data in the same way. They all return JSON-formatted data, and the format for success is always: This is similar to what I was thinking. In the end, I'll have a bit of framework I can use in other applications.. In any given application, I tend to have a wrapper around Prototype's ajax stuff with some problem-domain logic in it. That wrapper always checks for the `success` flag on calls and routes to the error handler if it's not there. Which would, I suppose, extend the framework to be even more generic.. Hrm.. Presumably this is just a simple subroutine call? Not much of a performance hit, is it? FWIW, -- T.J. Crowder - --- Jason 'XenoPhage' Frisvold xenoph...@godshell.com - --- Any sufficiently advanced magic is indistinguishable from technology. - - Niven's Inverse of Clarke's Third Law -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.14 (Darwin) iEYEARECAAYFAkwiv9oACgkQ8CjzPZyTUTT8tQCeN87dhX+o0px6xNSKJJ/LbAWG kMMAn1p5Q/E47IBcxG3/LrxEDm8HH0OD =nQXW -END PGP SIGNATURE- -- 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-scriptacul...@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.
[Proto-Scripty] Re: extjs + prototype + myCalendar
On Jun 23, 5:39 pm, doug douglass_da...@earthlink.net wrote: I am using extjs with prototype. I am using the calendar for extjs located here: http://www.feyasoft.com/myCalendar?tab=download The calendar works just fine without the prototype adapter. When I use it with prototype I get this error in Firefox: [Exception... Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIXMLHttpRequest.send] nsresult: 0x80004005 (NS_ERROR_FAILURE) location: JS frame ::http:///prototype.js:: anonymous :: line 1421 data: no] This happens whenever an ajax request is made. I have tried prototype 1.6 and 1.6.1. Where it occurs in prototype is line 1421 this.transport.send(this.body); Where this.body is userId=1 Any suggestions? Also, it seems to work for a while, but then Ajax requests stop working. -- 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-scriptacul...@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.