Now I have the custom page (e.g. register) appears correctly, however, when
I submit the form nothing happens - the form just clears itself with no
error msg or anything.
My 'register' action in controller is:
def register():
return dict(form=auth.register())
My 'layout.html' is as follows:
<!DOCTYPE html>
<html class="no-js" lang="{{=T.accepted_language or 'en'}}">
<head>
<meta charset="utf-8" />
<title>{{=response.title or request.application}}</title>
<meta name="application-name" content="{{=request.application}}" />
<!-- for Google -->
<meta name="google-site-verification" content="my_code" />
<!-- Mobile Viewport Fix
j.mp/mobileviewport & davidbcalhoun.com/2010/viewport-metatag
device-width: Occupy full width of the screen in its current orientation
initial-scale = 1.0 retains dimensions instead of zooming out if page
height > device height
user-scalable = yes allows the user to zoom in -->
<meta name="viewport" content="width=device-width, initial-scale=1.0,
user-scalable=yes">
<!-- All JavaScript at the bottom, except for Modernizr which enables
HTML5 elements & feature detects -->
<script src="{{=URL('static','js/modernizr.custom.js')}}"></script>
<!-- include stylesheets -->
{{
response.files.append(URL('static','css/bootstrap.min.css'))
response.files.append(URL('static','css/bootstrap-responsive.min.css'))
}}
{{include 'web2py_ajax.html'}}
</head>
<body class="{{=body_class}}">
{{include}}
{{if response.google_analytics_id:}}<script type="text/javascript"> var
_gaq = _gaq || []; _gaq.push(['_setAccount',
'{{=response.google_analytics_id}}']); _gaq.push(['_trackPageview']);
(function() { var ga = document.createElement('script'); ga.type =
'text/javascript'; ga.async = true; ga.src = ('https:' ==
document.location.protocol ? 'https://ssl' : 'http://www') +
'.google-analytics.com/ga.js'; var s =
document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga,
s); })(); </script> {{pass}}
</body>
</html>
And my 'register.html' view is:
{{body_class = 'own'}}
{{
response.files.append(URL('static', 'css/jquery.h5form-2.4.1.css'))
response.files.append(URL('static', 'css/own.css'))
}}
{{extend 'layout.html'}}
<div class="container own-container">
<h1>Sign up</h1>
<h5>Create Your Account</h5>
<div class="row">
<div class="span12">
<form action="" enctype="multipart/form-data" method="post"
class="own-form h5form">
<div class="own-labels">
<label>First name<sup>*</sup></label>
<input type="text" name="first_name" class="span3"
placeholder="enter first name ..." required="required" tabindex="0">
<label>Last name<sup>*</sup></label>
<input type="text" name="last_name" class="span3"
placeholder="enter last name ..." required="required" tabindex="1">
<label>Email<sup>*</sup></label>
<input type="email" name="email" class="span3"
placeholder="enter email ..." required="required" tabindex="2">
<label>Password<sup>*</sup></label>
<input type="password" name="password" class="span3"
placeholder="enter password ..." required="required" tabindex="3">
<label>Re-password<sup>*</sup></label>
<input type="password" name="password" class="span3"
placeholder="enter password again ..." required="required" tabindex="4">
</div>
<div class="pull-left">
<label class="checkbox">
<input type="checkbox" tabindex="5">I acknowledge
that I have read and accept <a href="#">the Terms and Conditions</a>
</label>
<input type="submit" class="btn pull-right"
style="margin-top: 15px;" value="Register">
</div>
</form>
</div>
</div>
</div>
<script src="{{=URL('static', 'js/jquery-1.7.2_min.js')}}"></script>
<script src="{{=URL('static', 'js/jquery.h5form-2.4.1.min.js')}}"></script>
<script src="{{=URL('static', 'js/own.js')}}"></script>
As advised by people earlier, in the form above, I match the 'name'
attribute of each input field with the corresponding column name of the *
auth_user *table. I wonder what is missing here?