For a Zope FormLib based form I wanted a ‘Cancel’ button. I tried some googling but couldn’t find any info on it. Here it is, it isn’t so hard:
First do some imports:
from plone.app.form.validators import null_validator
from Products.statusmessages.interfaces import IStatusMessage
The cancel function:
@form.action(“Cancel”, validator=null_validator)
def action_cancel(self, action, data):
….context = aq_inner(self.context)
….IStatusMessage(self.request).addStatusMessage(_(‘Cancelled’), type=’info’)
….self.request.response.redirect(\
….context.absolute_url()+’/@@mypage’)
nb. wordpress messes with the indentation, hence the dots. time for a code mark-up plugin….
Posted in Plone | No Comments »
I’m using KSS in Plone to ajaxify user interface actions. When you’ve got a server-side KSS method and would like to call a client action, here’s how it is done:
self.commands.addCommand(‘alert’, ‘.dummy-selector, message=’I'm called from the server!’)
self.commands.addCommand(‘myKssAction’, ‘my-selector’, param_1=”, param_n=”)
This way you can do necessary things (like storing data from a form), update the info on the page and using the above to call a Jquery function to do fancy style effects.
Simple as that!
Posted in Plone | No Comments »
November 28th, 2008 by kc
Posted in Uncategorized | No Comments »
November 28th, 2008 by kc
Posted in Music, Travel | 1 Comment »
Here is the service guide for the HP Compaq NC8430 laptop: service manual. Seems there are no copyright restrictions. The guide is perfect for part number reference and disassembly.
Posted in ict | 1 Comment »
Part of the Wat Phra Kaew Temple in Bangkok and food stalls selling seafood.
Floating market in a small village and a waterfall in the Khanchanburi province.
Pretty flower and a waterfall on the Ko Samui island.
The Petronas towers in Kuala Lumpur and Singapores chinatown (with skyline at night).
Posted in Travel | No Comments »