[web2py] Re: checkbox with label on the left side

2016-03-08 Thread Viator
Hello Paolo!

Thank you very much for your Input. Looks promising.  I will try it this 
way.

Thorsten

>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: checkbox with label on the left side

2016-03-07 Thread Paolo Caruccio
In my sqlforms, I solved the issue with css.

Prerequisite 1: formstyle = divs
Prerequisite 2: you have to know the id of the field outer div i.e. that 
containing the div.w2p_fl and the div.w2p_fw
 Generally it is build as tablename_fieldname__row (for 
more on this subject see 
http://www.web2py.com/books/default/chapter/29/11/#Conditional-fields-in-forms)

For example in a auth login form having formstyle = divs the field 
containing the "remember me checkbox" will be rendered:

 
 
 Ricordami (per 30 giorni)
 
 
 
 
 



So by setting in a custom css:

#auth_user_remember_me__row {
display: -ms-flexbox;
-webkit-display: flex;
display: flex;
}


#auth_user_remember_me__row .w2p_fl {
-ms-flex-order: 2;
-webkit-order: 2;
order: 2;
}


#auth_user_remember_me__row .w2p_fw {
-ms-flex-order: 1;
-webkit-order: 1;
order: 1;
}


we should have the chackbox on the left and its label on the right.

Remarks:
maybe you will need to add more rules depending on the css framework you 
use;
this will not work in IE9 and below versions;
for more info on flexbox see http://caniuse.com/#feat=flexbox

In the attached image (taken from the layout based on semantic-ui css 
framework on which I'm working in these days ) you will see the resulting 
form.



Il giorno lunedì 7 marzo 2016 19:39:55 UTC+1, Viator ha scritto:
>
> Hello dear knowers!
>
> I tried the whole day to create a form with a checkbox with its label on 
> the  left side instead of on the right side.
>
> But with no success. So far I ended up with a field as simple string and 
> the option to select 'yes' or 'no'. But in this case the confirmation does 
> not work. The dialog pops up but no matter if I chosse OK or Cancel the 
> value of the fied will be changed.
>
> I also tried to create the entire form with DIV() and styles wich worked 
> but I had to to all the design by hand. So I thought I will use 
> SQLFORM.factory which does a great job but I could not figure out how to 
> place the label of the checkbox on the left side.
>
> Please, could someone push me into the right direction?
>
> Thank you, Thorsten
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.