You need to add the flash message somewhere in the page:
<div class="flash">{{=response.flash or ''}}</div>
This is where it is in the default layout.
You'll also need CSS something like found here.
문제
I have written the code to create a custom form. It is a simple form which has some textboxes elements on it. When I submit the form, it gets processed but it doesn't show the flash message. I do not want to extend my view from layout.html
, however I am using the .js
files that are used by layout.html
My code in the controller is as given below:
myform=SQLFORM.factory(
Field('field1','unicode',requires=IS_NOT_EMPTY()),
Field('field2','unicode',requires=IS_NOT_EMPTY()),
submit_button = 'Add',
formstyle="divs",_id="form1"
)
if myform.process(formname='myform',keepvalues=True).accepted:
response.flash = 'form accepted'
The .js files I use in my view are given below:
<link href="{{=URL('static','css/payments/css/style.css')}}" rel="stylesheet" />
<script src="{{=URL('static','js/modernizr.custom.js')}}" type="text/javascript" charset="UTF-8"></script>
<script src="{{=URL('static','js/web2py.js')}}" type="text/javascript" charset="UTF-8"></script>
<script src="{{=URL('static','js/jquery.js')}}" type="text/javascript" charset="UTF-8"></script>
<script src="{{=URL('static','js/val/dist/jquery.validate.js')}}" type="text/javascript"></script>
<script src="{{=URL('static','js/jquery-ui-1.10.3.custom.js')}}" type="text/javascript"></script>
<script type="text/javascript" src="{{=URL('static','js/genaral.js')}}"></script>
Please let me know if I have missed anything important.