search_form = SQLFORM.factory(Field('Search', requires=IS_ALPHANUMERIC()))
button = search_form.element('input[type=submit]')
...
there should not be submit_button=' '.
You can try change it to button:
parent=search_form.element('input[type=submit]').parent
parent.contents=[TAG.BUTTON(....)]
On Tuesday, 31 July 2012 08:36:31 UTC-5, Alec Taylor wrote:
>
> Thanks, but I haven't been able to get that to work either:
>
> search_form = SQLFORM.factory(Field('Search', requires=IS_ALPHANUMERIC
> ()), submit_button=' ')
> #<div class="input-append">
> # <input class="span2" id="appendedInputButton" size="16"
> type="text"><button class="btn" type="button">Go!</button>
> #</div>
> button = search_form.element('input[type=submit]')
> #button['_type'] = 'image'
> button['_class'] = 'btn; btn-mini;'
> #button['_class'] = 'icon-search'
> button['_style'] = 'background-image:
> url("/static/images/glyphicons-halflings.png"); background-position: 14px
> 14px; background-repeat: no-repeat; display: inline-block; height: 14px;
> line-height: 14px; vertical-align: text-top; width: 14px;
> background-position: -48px 0;'
> #search_form[0].insert(1,INPUT(_style='background-image:
> url("/static/images/glyphicons-halflings.png"); background-position: 14px
> 14px; background-repeat: no-repeat; display: inline-block; height: 14px;
> line-height: 14px; vertical-align: text-top; width: 14px;
> background-position: -48px 0;', _class='btn; btn-mini',_type='submit', ))
> #button['_src'] = '/static/images/glyphicons-halflings.png'
>
> Would it be possible to change it from an INPUT tag to a BUTTON tag? -
> That would work much more natural with bootstrap for putting a simple
> search box like: [search here][search icon]
>
> Otherwise, is there another way to do it?
>
> Thanks for all suggestions,
>
> Alec Taylor
>
> On Tuesday, July 31, 2012 11:03:44 PM UTC+10, Massimo Di Pierro wrote:
>>
>> search_form = SQLFORM.factory(Field('Search', requires=IS_ALPHANUMERIC())
>>
>> button = search_form.element('input[type=submit]')
>>
>> button['_type'] = 'image'
>>
>> button['_src'] = '....'
>>
>>
>>
>> On Tuesday, 31 July 2012 00:27:37 UTC-5, Alec Taylor wrote:
>>>
>>> Thanks, is there also some way of adding the icon to an SQLFORM submit
>>> button?
>>>
>>> I've attempted:
>>>
>>> search_form = SQLFORM.factory(Field('Search', requires=IS_ALPHANUMERIC()),
>>> submit_button='Search')
>>>
>>> search_form[0].insert(1,INPUT(I(_class='icon-search'), _type='submit',
>>> _value='submit me'))
>>> search_form[0].insert(1,P(INPUT(_type='submit', _value='submit me')
>>> _class='icon-search'))
>>> search_form[0].insert(1,DIV(INPUT(_type='submit', _value='submit me',
>>> _class=' icon-search')))
>>> search_form[0].insert(1,I(INPUT(_type='submit', _value='submit me',
>>> _class=' icon-search')))
>>>
>>>
>>> On Tue, Jul 31, 2012 at 3:04 PM, Annet <[email protected]> wrote:
>>>
>>>> Hi Anthony,
>>>>
>>>> Thanks for your reply, problem solved.
>>>>
>>>> Maybe this should be documented somewhere, since these icons are part
>>>> of Bootstrap's Base CSS, which is part of web2py 2.0
>>>>
>>>>
>>>> Kind regards,
>>>>
>>>> Annet
>>>>
>>>> --
>>>>
>>>>
>>>>
>>>>
>>>
>>>
--