[Cubicweb] Controller and message display without reloading

Sylvain Thénault sylvain.thenault at logilab.fr
Tue Sep 4 10:40:29 CEST 2012

On 31 août 13:45, Stéphane Bugat wrote:
> Dear CW users,

Hi Stéphane,
> Following a discussion we had auc & I on #public, here is a synthesis of my issue:
> I have developed a table view to display a list of contacts, and I added a search field to look for other contacts still not connected (by firstname, surname, and so on). For that, I have chosen to define a form with a single string widget and put a "form.render(...)" in the call method of the view.
> I added a controller to the form, of course. In some cases, if the rset resulting from the query using the search field is not empty, I redirect to another view with this controller. But if the rset is empty, I want my controller to stay on the same view but display a message in the notification bar, something like 'No results were found sorry'.
> And, the final point: I want this *without having to reload the whole view* (which can be a bit long depending on the query to get all contacts).
> How can I proceed?

You will have to write a custom javascript function which will handle
for form posting and processing of the result.

Existing js functions that may be useful / source of inspiration:

- validateForm: to post a "regular form" (ie processed by the 'edit' controller)
- updateMessage: to display a message in the notification bar
- reload: to reload part of a page with result of a view/component/etc.

Hope that helps.
Sylvain Thénault, LOGILAB, Paris ( - Toulouse (
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
CubicWeb, the semantic web framework:    http://www.cubicweb.org

More information about the Cubicweb mailing list