Ajax.InPlaceSelect updated
September 21st, 2006 by SubZane
I took the liberty to update InPlaceSelect class for scriptaculous since I felt some features where missing.
- Added option “okButton” (default true)
- Added option “okText” (default ‘ok’)
- Added option “cancelText” (default ‘cancel’)
- Added option to take use of the onChange method or not. (default false)
Previous version available here
This article has been awarded a whole page, go here for commenting and more information.
Nice work. The previous version of InPlaceSelect desperately needed an ok button. You saved me from having to write it myself. Thank you!
Hi!
somehow the in-place-select won’t work! I always get the following error:
Error: element has no properties
Source: …/prototype.js
Line: 1167
my test implementation:
//
I’m currently working with Prototype version 1.5.0_rc1!
It would be great if you have time to help me with that error!
Thanks!
btw: You seem to be almost the only one on the net, who is working on that in-place-select editor (@see: google results and rails/prototype mailing lists)! Great work!
I will take a look at that, however my implementation does work here for me… hmmm weird.
When do you get the JS error? onLoad or onclick?
onLoad - it’s in the JavaScript log of Firefox right after the page load. Well, I’m not that good at js debugging and so I wasn’t able to figure out whats wrong with the mentioned “element” (probably the select box I believe).
I looked just now, I get that very same error message, and I found what’s doing it as well.
However, it still works for me, even tho I get errors.
If you comment out 1 line, (it’s the onComplete part that doesn’t work anyway) It won’t give you error messages anymore.
This line:
//this.options.onComplete.bind(this)(transport, this.element);
If you know how to, I’d be most grateful if you could solve the onComplete situation as well, since I failed that part. If you cannot, maybe posting a link to this page will increase the traffic and the possibility of someone else fixing it
I’m sorry: The problem was quite simple - I forgot to create a div with a correct ID …
After that it also didn’t work yet, because “builder.js” wasn’t included!
@commenting out the line:
I wasn’t able to find that line neither in the sciptaculous lib or in the inplaceselect script, but it works
Thank you for your help!
Seems like I removed that line from the published version, that’s why you didn’t find it hehe

Good to know it’s working, good luck with your scripts and don’t hesitate to improve it further
I think that you can make a fix in line 148:
var value = this.element.innerHTML.replace(/^\s*|\s*$/g,”");
In my element, the value come with a new line before the string, and need to be make ltrim and rtrim, with that mod in regexp I fix it.
Very Good work with InPlaceSelect, thanks so much to share it with us!
You mentioned that support for multiple selects is forthcoming…I am working on a project that requires this and could help fund the development of this feature if it could be done soon-ish. I tried e-mailing you, but no luck.
Thanks
adding this line to the onComplete function seams to work. Any comments?
eval(this.options.onComplete);