How to use the html.INPUT function in html

To help you get started, we’ve selected a few html examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github web2py / web2py / gluon / sqlhtml.py View on Github external
fadd = SCRIPT("""
        jQuery('#w2p_query_panel input,#w2p_query_panel select').css(
               'width','auto').css('float','left');
        jQuery(function(){web2py_ajax_fields('#w2p_query_panel');});
        function w2p_build_query(aggregator,a){
          var b=a.replace('.','-');
          var option = jQuery('#w2p_field_'+b+' select').val();
          var value = jQuery('#w2p_value_'+b).val().replace('"','\\\\"');
          var s=a+' '+option+' "'+value+'"';
          var k=jQuery('#web2py_keywords');
          var v=k.val();
          if(aggregator=='new') k.val(s); else k.val((v?(v+' '+ aggregator +' '):'')+s);
          jQuery('#w2p_query_panel').slideUp();
        }
        """)
        return (INPUT(
                _value=T("Query"),_type="button",_id="w2p_query_trigger",
                _onclick="jQuery('#w2p_query_fields').change();jQuery('#w2p_query_panel').slideToggle();"),
                DIV(_id="w2p_query_panel",
                    _class='hidden',
                    *criteria),
                fadd)
github web2py / web2py / gluon / sqlhtml.py View on Github external
search_widget = lambda sfield, url: FORM(
                    mq,
                    INPUT(_name='keywords',_value=request.vars.keywords,
                          _id='web2py_keywords'),
                    INPUT(_type='submit',_value=T('Search')),
                    INPUT(_type='submit',_value=T('Clear'),
                          _onclick="jQuery('#web2py_keywords').val('');"),
                    mf,ms,_method="GET",_action=url)
            form = search_widget and search_widget(sfields,url()) or ''
github spiffytech / MobileBlur / gluon / sqlhtml.py View on Github external
options = search_options.get(field.type,None)
            if options:
                label = isinstance(field.label,str) and T(field.label) or field.label
                selectfields.append((str(field),label))
                operators = SELECT(*[T(option) for option in options])
                if field.type=='boolean':
                    value_input = SELECT(
                        OPTION(T("True"),_value="T"),OPTION(T("False"),_value="F"),
                        _id="w2p_value_"+name)
                else:
                    value_input = INPUT(_type='text',_id="w2p_value_"+name,_class=field.type)
                new_button = INPUT(_type="button", _value=T('New'),
                                  _onclick="w2p_build_query('new','"+str(field)+"')")
                and_button = INPUT(_type="button", _value=T('And'),
                                   _onclick="w2p_build_query('and','"+str(field)+"')")
                or_button = INPUT(_type="button", _value=T('Or'),
                                  _onclick="w2p_build_query('or','"+str(field)+"')")

                criterion.extend([operators,value_input,new_button,and_button,or_button])
            criteria.append(DIV(criterion, _id='w2p_field_%s' % name,
                                _class='w2p_query_row hidden'))
        criteria.insert(0,SELECT(
                _id="w2p_query_fields",
                _onchange="jQuery('.w2p_query_row').hide();jQuery('#w2p_field_'+jQuery('#w2p_query_fields').val().replace('.','-')).show();",
                *[OPTION(label, _value=fname) for fname,label in selectfields]))
        fadd = SCRIPT("""
        jQuery('#w2p_query_panel input,#w2p_query_panel select').css(
               'width','auto').css('float','left');
        jQuery(function(){web2py_ajax_fields('#w2p_query_panel');});
        function w2p_build_query(aggregator,a){
          var b=a.replace('.','-');
          var option = jQuery('#w2p_field_'+b+' select').val();
github jyr / MNPP / Library / python26 / lib / python2.6 / site-packages / gluon / sqlhtml.py View on Github external
Optionally provides an A link to the file, including a checkbox so
        the file can be deleted.
        All is wrapped in a DIV.

        see also: :meth:`FormWidget.widget`

        :param download_url: Optional URL to link to the file (default = None)
        """

        default=dict(
            _type='file',
            )
        attr = UploadWidget._attributes(field, default, **attributes)

        inp = INPUT(**attr)

        if download_url and value:
            url = download_url + '/' + value
            (br, image) = ('', '')
            if UploadWidget.is_image(value):
                br = BR()
                image = IMG(_src = url, _width = UploadWidget.DEFAULT_WIDTH)

            requires = attr["requires"]
            if requires == [] or isinstance(requires, IS_EMPTY_OR):
                inp = DIV(inp, '[',
                          A(UploadWidget.GENERIC_DESCRIPTION, _href = url),
                          '|',
                          INPUT(_type='checkbox',
                                _name=field.name + UploadWidget.ID_DELETE_SUFFIX),
                          UploadWidget.DELETE_FILE,
github spiffytech / MobileBlur / gluon / sqlhtml.py View on Github external
search_widget = lambda sfield, url: FORM(
                    SQLFORM.search_menu(sfields),
                    INPUT(_name='keywords',_value=request.vars.keywords,
                          _id='web2py_keywords'),
                    INPUT(_type='submit',_value=T('Search')),
                    INPUT(_type='submit',_value=T('Clear'),
                          _onclick="jQuery('#web2py_keywords').val('');"),
                    _method="GET",_action=url)
            sfields = reduce(lambda a,b:a+b,
github web2py / pydal / gluon / sqlhtml.py View on Github external
criteria = []
        selectfields = []
        for field in fields:
            name = str(field).replace('.','-')
            criterion = []
            options = search_options.get(field.type,None)
            if options:
                label = isinstance(field.label,str) and T(field.label) or field.label
                selectfields.append((str(field),label))
                operators = SELECT(*[T(option) for option in options])
                if field.type=='boolean':
                    value_input = SELECT(
                        OPTION(T("True"),_value="T"),OPTION(T("False"),_value="F"),
                        _id="w2p_value_"+name)
                else:
                    value_input = INPUT(_type='text',_id="w2p_value_"+name,_class=field.type)
                new_button = INPUT(_type="button", _value=T('New'),
                                  _onclick="w2p_build_query('new','"+str(field)+"')")
                and_button = INPUT(_type="button", _value=T('And'),
                                   _onclick="w2p_build_query('and','"+str(field)+"')")
                or_button = INPUT(_type="button", _value=T('Or'),
                                  _onclick="w2p_build_query('or','"+str(field)+"')")

                criterion.extend([operators,value_input,new_button,and_button,or_button])
            criteria.append(DIV(criterion, _id='w2p_field_%s' % name,
                                _class='w2p_query_row hidden'))
        criteria.insert(0,SELECT(
                _id="w2p_query_fields",
                _onchange="jQuery('.w2p_query_row').hide();jQuery('#w2p_field_'+jQuery('#w2p_query_fields').val().replace('.','-')).show();",
                *[OPTION(label, _value=fname) for fname,label in selectfields]))
        fadd = SCRIPT("""
        jQuery('#w2p_query_panel input,#w2p_query_panel select').css(
github web2py / web2py / gluon / sqlhtml.py View on Github external
attr['_class']='string'
            name = attr['_name']
            if 'requires' in attr: del attr['requires']
            attr['_name'] = key2
            value = attr['value']
            record = self.db(self.fields[1]==value).select(self.fields[0]).first()
            attr['value'] = record and record[self.fields[0].name]
            attr['_onblur']="jQuery('#%(div_id)s').delay(3000).fadeOut('slow');" % \
                dict(div_id=div_id,u='F'+self.keyword)
            attr['_onkeyup'] = "jQuery('#%(key3)s').val('');var e=event.which?event.which:event.keyCode; function %(u)s(){jQuery('#%(id)s').val(jQuery('#%(key)s :selected').text());jQuery('#%(key3)s').val(jQuery('#%(key)s').val())}; if(e==39) %(u)s(); else if(e==40) {if(jQuery('#%(key)s option:selected').next().length)jQuery('#%(key)s option:selected').attr('selected',null).next().attr('selected','selected'); %(u)s();} else if(e==38) {if(jQuery('#%(key)s option:selected').prev().length)jQuery('#%(key)s option:selected').attr('selected',null).prev().attr('selected','selected'); %(u)s();} else if(jQuery('#%(id)s').val().length>=%(min_length)s) jQuery.get('%(url)s?%(key)s='+escape(jQuery('#%(id)s').val()),function(data){if(data=='')jQuery('#%(key3)s').val('');else{jQuery('#%(id)s').next('.error').hide();jQuery('#%(div_id)s').html(data).show().focus();jQuery('#%(div_id)s select').css('width',jQuery('#%(id)s').css('width'));jQuery('#%(key3)s').val(jQuery('#%(key)s').val());jQuery('#%(key)s').change(%(u)s);jQuery('#%(key)s').click(%(u)s);};}); else jQuery('#%(div_id)s').fadeOut('slow');" % \
                dict(url=self.url,min_length=self.min_length,
                     key=self.keyword,id=attr['_id'],key2=key2,key3=key3,
                     name=name,div_id=div_id,u='F'+self.keyword)
            if self.min_length==0:
                attr['_onfocus'] = attr['_onkeyup']
            return TAG[''](INPUT(**attr),INPUT(_type='hidden',_id=key3,_value=value,
                                               _name=name,requires=field.requires),
                           DIV(_id=div_id,_style='position:absolute;'))
        else:
            attr['_name']=field.name
            attr['_onblur']="jQuery('#%(div_id)s').delay(3000).fadeOut('slow');" % \
                dict(div_id=div_id,u='F'+self.keyword)
            attr['_onkeyup'] = "var e=event.which?event.which:event.keyCode; function %(u)s(){jQuery('#%(id)s').val(jQuery('#%(key)s').val())}; if(e==39) %(u)s(); else if(e==40) {if(jQuery('#%(key)s option:selected').next().length)jQuery('#%(key)s option:selected').attr('selected',null).next().attr('selected','selected'); %(u)s();} else if(e==38) {if(jQuery('#%(key)s option:selected').prev().length)jQuery('#%(key)s option:selected').attr('selected',null).prev().attr('selected','selected'); %(u)s();} else if(jQuery('#%(id)s').val().length>=%(min_length)s) jQuery.get('%(url)s?%(key)s='+escape(jQuery('#%(id)s').val()),function(data){jQuery('#%(id)s').next('.error').hide();jQuery('#%(div_id)s').html(data).show().focus();jQuery('#%(div_id)s select').css('width',jQuery('#%(id)s').css('width'));jQuery('#%(key)s').change(%(u)s);jQuery('#%(key)s').click(%(u)s);}); else jQuery('#%(div_id)s').fadeOut('slow');" % \
                dict(url=self.url,min_length=self.min_length,
                     key=self.keyword,id=attr['_id'],div_id=div_id,u='F'+self.keyword)
            if self.min_length==0:
                attr['_onfocus'] = attr['_onkeyup']
            return TAG[''](INPUT(**attr),DIV(_id=div_id,_style='position:absolute;'))
github web2py / web2py / gluon / sqlhtml.py View on Github external
url(args=['view',tablename,id])))
                    if editable and (not callable(editable) or editable(row)):
                        row_buttons.append(gridbutton(
                                'buttonedit', 'Edit',
                                url(args=['edit',tablename,id])))
                    if deletable and (not callable(deletable) or deletable(row)):
                        row_buttons.append(gridbutton(
                                'buttondelete', 'Delete',
                                callback=url(args=['delete',tablename,id]),
                                delete='tr'))
                    tr.append(row_buttons)
                tbody.append(tr)
            htmltable.append(tbody)
            htmltable = DIV(htmltable,_style='width:100%;overflow-x:auto')
            if selectable:
                htmltable = FORM(htmltable,INPUT(_type="submit"))
                if htmltable.process(formname=formname).accepted:#
                    htmltable.vars.records = htmltable.vars.records or []
                    htmltable.vars.records = htmltable.vars.records if type(htmltable.vars.records) == list else [htmltable.vars.records]
                    records = [int(r) for r in htmltable.vars.records]
                    selectable(records)
                    redirect(referrer)
        else:
            htmltable = DIV(T('No records found'))
        res = DIV(console,
                  DIV(htmltable,_class="web2py_table"),
                  DIV(paginator,_class=\
                          "web2py_paginator %(header)s %(cornerbottom)s" % ui),
                  _class='%s %s' % (_class, ui.get('widget')))
        res.create_form = create_form
        res.update_form = update_form
        res.view_form = view_form
github web2py / pydal / gluon / sqlhtml.py View on Github external
selectfields = []
        for field in fields:
            name = str(field).replace('.','-')
            criterion = []
            options = search_options.get(field.type,None)
            if options:
                label = isinstance(field.label,str) and T(field.label) or field.label
                selectfields.append((str(field),label))
                operators = SELECT(*[T(option) for option in options])
                if field.type=='boolean':
                    value_input = SELECT(
                        OPTION(T("True"),_value="T"),OPTION(T("False"),_value="F"),
                        _id="w2p_value_"+name)
                else:
                    value_input = INPUT(_type='text',_id="w2p_value_"+name,_class=field.type)
                new_button = INPUT(_type="button", _value=T('New'),
                                  _onclick="w2p_build_query('new','"+str(field)+"')")
                and_button = INPUT(_type="button", _value=T('And'),
                                   _onclick="w2p_build_query('and','"+str(field)+"')")
                or_button = INPUT(_type="button", _value=T('Or'),
                                  _onclick="w2p_build_query('or','"+str(field)+"')")

                criterion.extend([operators,value_input,new_button,and_button,or_button])
            criteria.append(DIV(criterion, _id='w2p_field_%s' % name,
                                _class='w2p_query_row hidden'))
        criteria.insert(0,SELECT(
                _id="w2p_query_fields",
                _onchange="jQuery('.w2p_query_row').hide();jQuery('#w2p_field_'+jQuery('#w2p_query_fields').val().replace('.','-')).show();",
                *[OPTION(label, _value=fname) for fname,label in selectfields]))
        fadd = SCRIPT("""
        jQuery('#w2p_query_panel input,#w2p_query_panel select').css(
               'width','auto').css('float','left');
github web2py / web2py / gluon / sqlhtml.py View on Github external
options = search_options.get(field.type,None)
            if options:
                label = isinstance(field.label,str) and T(field.label) or field.label
                selectfields.append((str(field),label))
                operators = SELECT(*[T(option) for option in options])
                if field.type=='boolean':
                    value_input = SELECT(
                        OPTION(T("True"),_value="T"),OPTION(T("False"),_value="F"),
                        _id="w2p_value_"+name)
                else:
                    value_input = INPUT(_type='text',_id="w2p_value_"+name,_class=field.type)
                new_button = INPUT(_type="button", _value=T('New'),
                                  _onclick="w2p_build_query('new','"+str(field)+"')")
                and_button = INPUT(_type="button", _value=T('And'),
                                   _onclick="w2p_build_query('and','"+str(field)+"')")
                or_button = INPUT(_type="button", _value=T('Or'),
                                  _onclick="w2p_build_query('or','"+str(field)+"')")

                criterion.extend([operators,value_input,new_button,and_button,or_button])
            criteria.append(DIV(criterion, _id='w2p_field_%s' % name,
                                _class='w2p_query_row hidden'))
        criteria.insert(0,SELECT(
                _id="w2p_query_fields",
                _onchange="jQuery('.w2p_query_row').hide();jQuery('#w2p_field_'+jQuery('#w2p_query_fields').val().replace('.','-')).show();",
                *[OPTION(label, _value=fname) for fname,label in selectfields]))
        fadd = SCRIPT("""
        jQuery('#w2p_query_panel input,#w2p_query_panel select').css(
               'width','auto').css('float','left');
        jQuery(function(){web2py_ajax_fields('#w2p_query_panel');});
        function w2p_build_query(aggregator,a){
          var b=a.replace('.','-');
          var option = jQuery('#w2p_field_'+b+' select').val();