Posts Tagged ‘javascript’

Building a RESTful Web application with PHP

Tuesday, February 17th, 2009

Recently I’ve been putting together a Web application for a research project. I decided it was about time I really looked properly into REST so my Web interfaces are better structured. I won’t go into all the benefits here, you can read for yourself. Suffice to say it seems like a good approach to take.

This is quite a long article and you might only be interested in some of it so here are the sections:

If you have an suggestions for improvement, please let me know – this was a first attempt!
(more…)

Dojo checkboxes

Thursday, July 3rd, 2008

I recently hit this snag when working with Dojo. Basically I wanted to set the checked status of a checkbox on a webpage programmatically. Simple you might think? Apparently not as easy as it should be.

Interaction with checkboxes has changed slightly in Dojo 1.1 (apparently) but myCheckbox.setValue(true) should be valid. When calling dojo.byId('my-checkbox-id').setValue(true), I was getting an error saying the method didn’t exist. The object was definitely the checkbox as I could determine the correct checked state from that object (myCheckbox.checked) so I was very confused. I then remembered another way to access objects with Dojo is using the HTML attribute ‘jsId‘. This creates a global javascript variable referring to that object in the DOM. So I set something like jsId='myCheckbox' and then called myCheckbox.setValue(true) and it worked!

Very odd behaviour. I can only guess that the javascript object created by Dojo using jsId and dojo.byId() is a different bit of code and creates an object pointing to the DOM checkbox object in a different way. Very strange but at least there’s the workaround above…