It appears Woodstock uses Prototype (www.prototypejs.org) to handle some of their behind the scenes work. I want to use Prototype to handle some Effects in my JSF project. I also want to use the .refresh() and .submit() functions on some Woodstock components. When I include Prototype in my JSF page these Woodstock javascript functions fall apart. I got the same version of Prototype that Woodstock uses, no luck. Is there any way to use Prototype's Effects without including the main prototype.js file?
Here's a quick work through that shows the bug:
- Create a new VisualWeb JSF project in Netbeans 6.1 (So that the Woodstock components are available).
- Drag a 'Checkbox' from the 'Woodstock Basic' pallete to the Page Design area.
- Under the checkbox's properties, give it the following onClick javascript:
document.getElementById('form1:checkbox1').submit();
- Double click the checkbox and put some System.out.println() statement in the _valueChange method that appears.
If you run this, clicking the checkbox will cause the component to submit itself by ajax (using Prototype I assume) and the print statement will show in the log.
- Now drag a 'Script' component from the 'Advanced' pallete to the Page Design area.
- Under it's properties, give it a url that points to a local copy of prototype.js (http://www.prototypejs.org/assets/2007/1/18/prototype.js).
If you run the page again, clicking the button gives a javascript error (in Woodstock's compressed javascript it appears) saying:
'0.length' is null or not an object
I was originally using Prototype v1.6.0 and getting a different error along the lines of:
Object doesn't support this property or method.
Any ideas how to get Prototype and Woodstock to play nice?