Tips Tricks Samples

dojo.io.bind, File Attachments and other fun

Things are still quiet, I am still on a roll with my application development. As mentioned previously I am putting together a Domino and Dojo framework, it's going well but slowly. Dojo is great but the documentation leaves a lot to be desired, I guess this is the downside of the bleeding edge. So I have spent quite some time getting file attachments / dojo.io.bind and Domino validation working together. I won't try and explain how dojo.io.bind works but what it does is degrade gracefully. When you submit a form it will first of all try and submit using pure AJAX, but if your form has a file upload control on it the submit over AJAX will not work so Dojo degrades to use the old iframe model of submission. This will work but the struggle then is to use input validation formulae in Domino. Ultimately what I have discovered is that when you use @Failure the return string must be wrapped in a textarea tag. Dojo uses the first textarea returned as the response text when dealing with file attachments. So now my input validation formula will look like this:
@If(@ThisValue=""; @Failure("<textarea>Please enter the value.</textarea>; @Success)

The text within the textarea tag will then be returned to the response handling javascript function.

I don't suppose this makes much sense unless you have played with Dojo, if you haven't then I'd definitely recommend it (or you could give it six months for the documentation to catch up to the capabilities). It's always dangerous making predictions about the future of the internet but I can definitely see one of the AJAX frameworks becoming the default standard for future web application development. With the backing behind Dojo and the well thought out architecture the team has already put together I think I'll be placing my allegiance with them.

On a totally different note, I have put my house on the market with a view to moving down to London. I tried this last year but didn't get very far so I'm not holding my breath but if I can knock the commute on the head it will give me a lot more time to spend on this interesting geeky stuff!