Hi,
You can try like this,
First of all you have to create a template for the page, which has to be displayed for entering the specific details.
You can create a page template like this,
<template id="acknowledge_page" name="Acknowledge" page="True">
<form method="post" action="/test/acknowledge">
<div class="container">
<b>Enter Details</b>
</div>
<div class="form-group form-field o_website_form_custom">
<font style="" class="text-gray">Test value1</font>
<div class="col-md-7 col-sm-8">
<input type="text" id="test_val" class="form-control o_website_form_input" name="Test Value1" required="True"/>
</div>
</div>
<div class="form-group form-field o_website_form_custom">
<font style="" class="text-gray">Test Value2</font>
<div class="col-md-7 col-sm-8">
<input type="text" id="test_val2" class="form-control o_website_form_input" name="Test Value2" required="True"/>
</div>
</div>
<div class="form-group">
<input type="submit" class="btn btn-primary btn-lg" value="Enter"/>
</div>
</form>
</template>
As the page template is created now we have to write route in the controller, suppose if we want to get this page on typing url like this or from clicking this url,
URL : http://0.0.0.0:8013/acknowledgement
Then in controller,
@http.route('/acknowledgement', type='http', csrf=False, auth="user", website=True)
def view_acknowledgment(self, **kwargs):
#return the template, template id is acknowledge_page
return request.render('module_name.acknowledge_page')Here as the auth="user" is given, before loading the acknowledgement page, the user will be redirected to login page and ask to enter his credentials,
After entering the credentials, user will be directed to the acknowledgment page.
Then we have to code the action for the submit button.
You may have to save the user entered details to the db, for this...,
On clicking the submit button, the route /test/acknowledge will work, (action of the form )
Inside this route we can access user entered value and save it to db.
@http.route('/test/acknowledge', type='http', csrf=False, auth="user", website=True)
def acknowledgment_save(self, **kwargs):
test_val = kwargs['test_val']
test_val2 = kwargs['test_val2']
# here write the code to save it to the db
return request.redirect('/')
Thanks