From 85b6c6dc096dfbf44d51a13a8a9d16e152e58fe8 Mon Sep 17 00:00:00 2001 From: Leif Johansson Date: Thu, 3 Mar 2011 11:48:43 +0100 Subject: client side validation --- templates/apps/invitation/edit.html | 10 +++++-- templates/apps/name/add.html | 10 +++++-- templates/apps/name/edit.html | 9 ++++-- templates/base.html | 56 +++++++++++++---------------------- templates/edit_fieldsets.html | 59 +++++++++++++++++++------------------ 5 files changed, 73 insertions(+), 71 deletions(-) (limited to 'templates') diff --git a/templates/apps/invitation/edit.html b/templates/apps/invitation/edit.html index 28fc447..b565d10 100644 --- a/templates/apps/invitation/edit.html +++ b/templates/apps/invitation/edit.html @@ -1,9 +1,15 @@ {% extends "edit_fieldsets.html" %} {% block widgets %} $('#id_expires').datepicker({'dateFormat': 'yy-mm-dd','timeFormat': 'hh:ii:ss'}); - $('#form').formwizard({ + $('#wizard').formwizard({ validationEnabled: true, focusFirstInput: true, - textSubmit: "Finish" + textSubmit: "Finish", + validationOptions: { + rules: { + email: 'email required', + expires: 'date required' + } + } }); {% endblock %} \ No newline at end of file diff --git a/templates/apps/name/add.html b/templates/apps/name/add.html index aba49ad..94086be 100644 --- a/templates/apps/name/add.html +++ b/templates/apps/name/add.html @@ -2,9 +2,15 @@ {% block widgets %} $('#id_expires').datepicker({'dateFormat': 'yy-mm-dd','timeFormat': 'hh:ii:ss'}); $('#id_description').wysiwyg(); - $('#form').formwizard({ + $('#wizard').formwizard({ validationEnabled: true, focusFirstInput: true, - textSubmit: "Finish" + textSubmit: "Finish", + validationOptions: { + rules: { + short: 'required', + value: 'required' + } + } }); {% endblock %} \ No newline at end of file diff --git a/templates/apps/name/edit.html b/templates/apps/name/edit.html index aba49ad..d963048 100644 --- a/templates/apps/name/edit.html +++ b/templates/apps/name/edit.html @@ -2,9 +2,14 @@ {% block widgets %} $('#id_expires').datepicker({'dateFormat': 'yy-mm-dd','timeFormat': 'hh:ii:ss'}); $('#id_description').wysiwyg(); - $('#form').formwizard({ + $('#wizard').formwizard({ validationEnabled: true, focusFirstInput: true, - textSubmit: "Finish" + textSubmit: "Finish", + validationOptions: { + rules: { + short: 'required' + } + } }); {% endblock %} \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index c702d71..4f93552 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,61 +1,45 @@ - - + + - - + + - + + - + - + {% block title %}{% endblock %} {% block js %}{% endblock %} diff --git a/templates/edit_fieldsets.html b/templates/edit_fieldsets.html index 75885d7..76778c1 100644 --- a/templates/edit_fieldsets.html +++ b/templates/edit_fieldsets.html @@ -3,39 +3,40 @@ {% block content %} {% block beforeform %} {% endblock %} -
-
+
+

{{formtitle}}

{% if form.non_field_errors %}{{ form.non_field_errors }}{% endif %} {% for fieldset in form.fieldsets %}
- {% if fieldset.legend %} - {{ fieldset.legend }} - {% endif %} - {% if fieldset.description %} -

{{ fieldset.description }}

- {% endif %} - + {% if fieldset.legend %} + {{ fieldset.legend }} + {% endif %} + {% if fieldset.description %} +

{{ fieldset.description }}

+ {% endif %} +
{% endfor %} -
-
-
- - - -
- +
+
    +
  • +
  • +
  • +
+
+ +
{% endblock %} \ No newline at end of file -- cgit v1.1