I have been working on enhancements to datacontroller.

One of the nice things that I want to integrate is client side error
detection to reduce roundtrips.  It would be a variation on this.

http://www.alvinwang.com/j2/errchk.js

The way it works is each field that you want to have checked will have
an onblur event that calls a javascript.  I will change the library to
match the widget datatypes.

The problems is that standard widgets have error fields but no ids so I
can stuff the error messages into them

class TextField(Widget):
    template = """
    <div xmlns:py="http://purl.org/kid/ns#"; py:strip="True">
    <input type="text" name="${widget.name}" value="${widget_value}"
id="${widget.name}" class="text_field" py:attrs="widget.attrs"/>
    <span class="field_error" ID="inf_${widget.name}"
py:if="widget_error">${str(widget_error)}</span>
    </div>
    """

If each widget had the ID="inf_${widget.name}" attribute added to it, I
am pretty sure that the widget attr clause could be used to pass in the
javascript call.

I would also need
onsubmit="return validateOnSubmit()" on the form tag.  I think I can
pass that into the form widget.

I guess the question would be if I should create my own set of widgets
or should this be included in the standard widgets.

Thanks
Alvin

Reply via email to