Skip to content

Commit

Permalink
check docs to make sure all is sensible
Browse files Browse the repository at this point in the history
  • Loading branch information
bigmassa committed Oct 25, 2017
1 parent d117244 commit 643efeb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
7 changes: 3 additions & 4 deletions docs/forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,12 @@ Example:
return form_data
.. note:: Its important to note here that the ``form.page`` and ``form.user`` seen above are passed in via the
``wagtailstreamforms.models.StreamFormPageMixin`` which is for forms that post to their own page.
``before_serve_page`` hook ``wagtailstreamforms.wagtail_hooks.process_form``.

If you want to use a different method of saving the form and you require these you will need to pass
them in yourself.
them in yourself when adding ``request.POST`` to the form.

Example usage cam be seen in the mixins serve method
`here <https://github.com/AccentDesign/wagtailstreamforms/blob/master/wagtailstreamforms/models/mixins.py#L55>`_.
Example usage can be seen in :ref:`rst_provide_own_submission`

Reference
---------
Expand Down
12 changes: 6 additions & 6 deletions docs/submission.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ Form Submission

Form submissions are handled by the means of a wagtail ``before_serve_page`` hook. The built in hook at
``wagtailstreamforms.wagtail_hooks.process_form`` looks for a form in the post request,
and either processes it redirecting back to the current page or just renders the page with
any validation errors if there are any.
and either:

* processes it redirecting back to the current page or defined page in the form setup.
* or renders the current page with any validation error.

If no form was posted then the page serves in the usual manner.

.. note:: Currently the hook expects the form to be posting to the same page it exists on.

.. _rst_provide_own_submission:

Providing your own submission method
------------------------------------

Expand All @@ -22,10 +26,6 @@ If you do not want the current hook to be used you need to disable it by setting
With this set no forms will be processed of any kind and you are free to process them how you feel fit.

* Your own hook
* A page mixin
* A view in django

An example of a hook:

.. code-block:: python
Expand Down
4 changes: 2 additions & 2 deletions docs/templates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Form Templates
You can create your own form templates to use against any form in the system, providing a vast array of ways to
create, style and submit your forms.

The default `template <https://github.com/AccentDesign/wagtailstreamforms/blob/master/wagtailstreamforms/templates/streamforms/form_block.html>`_ used can be seen below:
The default template located at ``streamforms/form_block.html`` can be seen below:

.. code-block:: html

Expand All @@ -18,7 +18,7 @@ The default `template <https://github.com/AccentDesign/wagtailstreamforms/blob/m
<input type="submit" value="{{ value.form.submit_button_text }}">
</form>

.. note:: It is important here to keep the hidden fields the form will create an additional field for the form id.
.. note:: It is important here to keep the hidden fields as the form will have some in order to process correctly.

Once you have created you own you will need to add it to the list of available templates.

Expand Down
6 changes: 3 additions & 3 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ And you are ready to go.
Using the template tag
----------------------

There is also a template tag you can use outside of a streamfield (but within a page served by wagtail).
There is also a template tag you can use outside of a streamfield, within a page.

All this is doing is rendering the form using the same block as in the streamfield.

Expand All @@ -26,12 +26,12 @@ The tag takes three parameters:
* **reference**: This should be a unique string and needs to be persistent on refresh/reload. See note below.
* **action**: The form action url.

.. note:: The reference is used when the form is being validated.
.. warning:: The reference is used when the form is being validated.

Because you can have any number of the same form on a page there needs to be a way of uniquely identifying the form beyond its ``PK``.
This is so that when the form has validation errors and it is passed back through the pages context, We know what form it is.

This reference MUST be persistent on page refresh or you will never see the errors.
This reference **MUST** be persistent on page refresh or you will never see the errors.

Usage:

Expand Down

0 comments on commit 643efeb

Please sign in to comment.