equal
deleted
inserted
replaced
97 |
97 |
98 Last but not least, we add two buttons control: one to post the form using |
98 Last but not least, we add two buttons control: one to post the form using |
99 javascript (`$('#sendmail')` being the jQuery call to get the element with DOM id |
99 javascript (`$('#sendmail')` being the jQuery call to get the element with DOM id |
100 set to 'sendmail', which is our form DOM id as specified by its `domid` |
100 set to 'sendmail', which is our form DOM id as specified by its `domid` |
101 attribute), another to cancel the form which will go back to the previous page |
101 attribute), another to cancel the form which will go back to the previous page |
102 using another javascript call. Also we specify image to used as button icon a |
102 using another javascript call. Also we specify an image to use as button icon as a |
103 resource identifier (see :ref:`external_resources`) given as last argument to |
103 resource identifier (see :ref:`external_resources`) given as last argument to |
104 :class:`cubicweb.web.formwidgets.ImgButton`. |
104 :class:`cubicweb.web.formwidgets.ImgButton`. |
105 |
105 |
106 To see this form, we still have to wrap it in a view. This is pretty simple: |
106 To see this form, we still have to wrap it in a view. This is pretty simple: |
107 |
107 |
160 if we successfully sent email, we redirect to the index page with proper message |
160 if we successfully sent email, we redirect to the index page with proper message |
161 to inform the user. |
161 to inform the user. |
162 |
162 |
163 Also notice that our controller has a selector that deny access to it to |
163 Also notice that our controller has a selector that deny access to it to |
164 anonymous users (we don't want our instance to be used as a spam relay), but also |
164 anonymous users (we don't want our instance to be used as a spam relay), but also |
165 check expected parameters are specified in forms. That avoid later defensive |
165 check expected parameters are specified in forms. That avoids later defensive |
166 programming (though it's not enough to handle all possible error cases). |
166 programming (though it's not enough to handle all possible error cases). |
167 |
167 |
168 To conclude our example, suppose we wish a different form layout and that existent |
168 To conclude our example, suppose we wish a different form layout and that existent |
169 renderers are not satisfying (we would check that first of course :). We would then |
169 renderers are not satisfying (we would check that first of course :). We would then |
170 have to define our own renderer: |
170 have to define our own renderer: |