Set Focus to autocomplete field

44 views
Skip to first unread message

Alejandro Martinez

unread,
Jan 5, 2015, 11:50:18 AM1/5/15
to agile-too...@googlegroups.com
Hi,

I have a form that has some fields.
One field is autocomplete
.
The field is filled with information from a table

$f->addField('autocomplete','idfield','Field')->setValueList( $this->api->db->dsql()  
 ->table('items')->field('id,name')->do_getAssoc() );

I'm trying to set the focus on that field when the page loads.

I have did this

On top of the page

$p->js()->_load('seteo_foco');

And then

seteo_foco.js

$(function(){
  $("select:first").focus();
})

But this does not work.

Anybody can help ?

Thanks

Gowrav Vishwakarma

unread,
Jan 6, 2015, 11:04:20 PM1/6/15
to agile-too...@googlegroups.com
$field = $f->addField('autocomplete/Basic','field_name');
$field->setModel('Item');
$field->other_field->js(true)->focus();

Autocomplete add-on extends Hidden input and adds another line type field, so there is no select

check the code for more https://github.com/atk4/autocomplete/blob/master/lib/Form/Field/Basic.php

Alejandro Martinez

unread,
Jan 7, 2015, 6:55:23 PM1/7/15
to agile-too...@googlegroups.com
Gowrav thanks for your response.

I'm doing this on an old versin (4.0.3 I know, I know....), is it possible ?

Thanks

--
You received this message because you are subscribed to the Google Groups "Agile Toolkit Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to agile-toolkit-d...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages