Dont put the web2py submit tag inside the button block just put Submit and in type and value att put Submit form will work as intended. And why did you change your python delimiter thats a odd one.
<div><button type="submit" value="submit" class="btn btn-primary">Submit</button></div>
just make sure its before the custom.end