Hi!

I'm looking for the basics in using _javascript_ client-side validation. Should I use Mochikit, or something alike?

Here's some code, which only implements basic server-side validation.

Thanks!

Alexandre

---------------------------------------------

class CriaNovoForm(widgets.TableForm):
fields = [
widgets.TextField(name="nome", label ="Nome:", validator =
validators.String(not_empty=True)),
widgets.TextField(name="descricao", label ="Descricao:"),
widgets.TextField(name="qtd" , label ="Capacidade:",
validator = validators.Int(not_empty=True))
]
submit_text = "Cria Form!"
action = ""> criaNovoForm = CriaNovoForm()

    class Main(controllers.RootController):
@expose(template="... template...")
def cadastrar(self, tg_errors = None):
if tg_errors:
turbogears.flash(u'Validation error!')
return dict(form=criaNovoForm)
@expose(template=" ... template... ")
@error_handler(cadastrar)
@validate(form=criaNovoForm)
def runCriaForm(self, nome, descricao, qtd):
# insert into database...
turbogears.flash("Successfully inserted")

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to