Input format is not controlled by the represent attribute. If you are using 
web2py_ajax.html and web2py.js, then time fields are controlled by the jQuery 
Time Entry <http://keith-wood.name/timeEntry.html> plugin (it is included 
in the calendar.js file that comes with web2py). There are instructions at 
that site for changing the defaults. If you don't want to use that plugin 
at all, you can do one of the following:

   - Edit web2py_ajax.html so it doesn't include calendar.js (though you 
   lose the date and datetime widgets in that case too).
   - Edit calendar.js to exclude the Time Entry plugin.
   - Change the widget of your time field by explicitly specifying 
   widget=SQLFORM.widgets.string.widget (the time widget is the same, except 
   it sets the class of the input element to "time" instead of "string").
   - Use the server-side DOM to manually change the "_class" attribute of 
   the input element from "time" to "string".

web2py.js looks for any input elements with class "time" and binds the Time 
Entry plugin to them, so as long as you change the class to something other 
than time (as in the last two methods above), the Time Entry plugin won't 
be activated.

Anthony

On Monday, April 22, 2013 6:16:16 PM UTC-4, Christian Espinoza wrote:
>
> Hi, I have this table definition:
>
>
> db.define_table('timetable',
>             Field('customer', db.customer, label='Cliente'),
>             Field('name', length=160, label='Nombre'), 
>             Field('start', 'time', label='Inicio' ),
>             Field('finish', 'time', label='Final' ),
>             signature
>             )
> db.timetable.start.represent = lambda value, row: value.strftime("%H:%M")
>
>
> and the represent function works only when the field is on view mode, but 
> when I edit it on the html input
> the data have this format: 12:00:00 and I don't want see the seconds..
>
> What is happens? I missed something? 
> I'm working with mysql..
>
> Greetings.
> Christian.
>

-- 

--- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to