diff --git a/test_project/test_app/forms.py b/test_project/test_app/forms.py
index c144bd0..fa57736 100644
--- a/test_project/test_app/forms.py
+++ b/test_project/test_app/forms.py
@@ -73,50 +73,12 @@ class LayoutTestForm(forms.Form):
submit = Submit('add','Add this contact')
helper.add_input(submit)
-
+class MessageResponseForm(forms.Form):
-class ComplexLayoutTest(forms.Form):
- """
- TODO: get digi604 to make this work
+ character_field = forms.CharField(label="Character Field", help_text="I am help text", max_length=30, required=True, widget=forms.TextInput())
- help_text = render_to_string("example/help_text.html")
- layout = Layout(Fieldset(_('Basic Settings'),
- 'title',
- 'type',
- 'available_date',
- ),
- Fieldset(_('Overview'),
- Column(Fieldset(_('Object address'),
- Row('address', 'street_number'),
- Row('zip', 'city'),
- 'area',
- ),
- Fieldset(_("Next public transport"),
- 'train_station',
- Row('tram_station','tram_number'),
- Row('bus_station','bus_number'),
- ),
- ),
- Column("is_for_rent",
- Fieldset(_("Rent"),
- 'rent-price',
- ),
- Fieldset(_("Sell"),
- 'buy_price',
- ),
- Fieldset(_("Measurements"),
- 'floor_space',
- 'room_height',
- 'construction_year',
- ),
- ),
- Fieldset(_('Additional Function'),
- HTML('
%s
' % unicode(help_text)),
- 'features',
- ),
- Fieldset(_("Description"),
- "description")
- )
- helper.add_layout(layout)
- """
\ No newline at end of file
+ def clean(self):
+ cleaned_data = self.cleaned_data
+ raise forms.ValidationError("This is a forced error")
+ return cleaned_data
diff --git a/test_project/test_app/templates/test_app/base.html b/test_project/test_app/templates/test_app/base.html
index ddba0bb..ffd0a9c 100644
--- a/test_project/test_app/templates/test_app/base.html
+++ b/test_project/test_app/templates/test_app/base.html
@@ -122,6 +122,7 @@ Test Pages
Layout test
Set action test
Lacking form tag
+ Message Response
diff --git a/test_project/test_app/templates/test_app/message_response.html b/test_project/test_app/templates/test_app/message_response.html
new file mode 100644
index 0000000..8b72d10
--- /dev/null
+++ b/test_project/test_app/templates/test_app/message_response.html
@@ -0,0 +1,11 @@
+{% extends "test_app/base.html" %}
+{% load uni_form_tags %}
+
+{% block body%}
+
+ Django Uni-Form message response test
+
+
+{% uni_form form helper %}
+
+{% endblock %}
\ No newline at end of file
diff --git a/test_project/test_app/urls.py b/test_project/test_app/urls.py
index 6e63e33..46a4520 100644
--- a/test_project/test_app/urls.py
+++ b/test_project/test_app/urls.py
@@ -9,6 +9,7 @@
url(r'^layout_test/$', "test_app.views.layout_test", name='layout_test'),
url(r'^view_helper_set_action/$', "test_app.views.view_helper_set_action", name='set_action_test'),
url(r'^lacking_form_tag/$', "test_app.views.lacking_form_tag", name='lacking_form_tag'),
+ url(r'^message_response/$', "test_app.views.message_response", name='message_response'),
)
\ No newline at end of file
diff --git a/test_project/test_app/views.py b/test_project/test_app/views.py
index 1335464..58f801c 100644
--- a/test_project/test_app/views.py
+++ b/test_project/test_app/views.py
@@ -4,7 +4,7 @@
from uni_form.helpers import FormHelper, Submit, Reset, Hidden
-from test_app.forms import TestForm, HelperTestForm, LayoutTestForm
+from test_app.forms import TestForm, HelperTestForm, LayoutTestForm, MessageResponseForm
def basic_test(request):
if request.method == "POST":
@@ -107,4 +107,28 @@ def lacking_form_tag(request):
return render_to_response('test_app/lacking_form_tag.html',
response_dictionary,
context_instance=RequestContext(request))
-
\ No newline at end of file
+
+def message_response(request):
+
+ if request.method == "POST":
+ form = MessageResponseForm(request.POST)
+ else:
+ form = MessageResponseForm()
+
+ # create a formHelper
+ helper = FormHelper()
+
+ # add in a error and success button
+ error = Submit('generate-result','Generate Error')
+ helper.add_input(error)
+
+ # add in a submit and reset button
+ success = Submit('generate-result','Generate Success')
+ helper.add_input(success)
+
+ # create the response dictionary
+ response_dictionary = {'form':form, 'helper': helper}
+
+ return render_to_response('test_app/message_response.html',
+ response_dictionary,
+ context_instance=RequestContext(request))
\ No newline at end of file
diff --git a/uni_form/templates/uni_form/whole_uni_form.html b/uni_form/templates/uni_form/whole_uni_form.html
index 9620ca7..ffd3ab3 100644
--- a/uni_form/templates/uni_form/whole_uni_form.html
+++ b/uni_form/templates/uni_form/whole_uni_form.html
@@ -1,10 +1,21 @@
{% load uni_form_tags i18n %}
+
{% if form_tag %}