Autofill field

QuestionsAutofill field
David asked 7 years ago

I want to autofill a colum but i cant i dunno what´s wrong

$col = array();
$col["title"] = "direccion";
$col["name"] = "direccion";
$col["width"] = "4";
$col["editable"] = true;
$col["align"] = "center";
$col["search"] = true;
$col["formatoptions"] = array( "sql"=>"SELECT direccion as k, nombre as v FROM supervisores","update_field"=>"direccion");
$col["formatoptions"] = array( "sql"=>"SELECT *, nombre as v FROM supervisores",
"search_on"=>"concat(nombre,'-',id)",
"callback"=>"fill_form");
<script>
function fill_form(data)
{
jQuery("input[nombre=direccion].FormElement").val(data.direccion);
jQuery("input[nombre=direccion].editable").val(data.direccion);

}
</script>

When i do the insert (nombre) on grid i want to autofill the direccion field

1 Answers
Abu Ghufran answered 7 years ago

Hello,

First, this line is redundant, which can be removed.
$col["formatoptions"] = array( "sql"=>"SELECT direccion as k, nombre as v FROM supervisores","update_field"=>"direccion");

Second, the <script> tag should be in <html> code section if not already there.

You can share complete code file for review. You can share at https://gist.github.com/

Your Answer

15 + 17 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?