Hi Dominique,

I believe the easiest would be to manually insert the submit button at
the appropriate location, as in the following example:

form = SQLFORM.factory(
  Field('name'),
  Field('age','integer'),
  formstyle='divs',
  buttons=[],
)
form[0].insert(1,DIV(INPUT(_type='submit', _value='submit me')))

Notes:
- the submit button will be in the middle of the form in this case
- you can further style the DIV or the INPUT as needed
- formstyle divs used here, it should work with the others too
- buttons=[] blocks the auto-created submit button at the bottom
- change the insert index to your desired location


On Nov 14, 5:26 am, Dominique <[email protected]> wrote:
> Hello All,
>
> I have a form built with SQLFORM.factory.
>
> I would like to change the position of the submit button.
>
> I know how to insert an element somewhere with for instance
> form[0][3][1].insert(-1, my_element) but not how to move the submit button
> from its pre-defined place (last row) to another place.
>
> I'd prefer not to define its place in the view but rather in the controller.
>
> For info, the hierarchy of the form is:
> form
> input1
> select1
> div1
> div2
> div class="w2p_fl"
> div class="w2p_fw"
> select id='bla1"
> select id="bla2"
> div class="w2p_fc"
> div3 id="submit_record_row"
> iv class="w2p_fl"
> div class="w2p_fw"
> input type="submit"
>  div class="w2p_fc"
>
> I'd like to move the submit button (which is in the div3) to the div2, just
> after the select id="bla2"
>
> Thanks in advance for any help
>
> Dominique

Reply via email to