Forums

show values

agostinopol 27 Feb, 2017
I have a table with 4 fields in the database (client, info1, info2, Info3)
the form has 4 elements, the first with autocomplete (customer), the remaining three elements detect the values of the info with this custom code

<?php
$db = \JFactory::getDBO();
$query = "
SELECT `nome`
FROM `aaa_tabella`
WHERE `codice` = '{$form->data['cliente']}' ;
";
$db->setQuery($query);
$form->data['nomecliente'] = $db->loadResult();
?>


the form of saving is ok, I would like to see instantly in 3 textbox the value saved.

thx
GreyHead 27 Feb, 2017
Hi agostinopol,

You might be able to do this by having the AutoComplete a combined value with say info1#info2#info3 - then you can use JavaScript to break that up into it's separate elements and set the input values.

Bob
agostinopol 01 Mar, 2017
Unfortunately, for various reasons I can not use Ajax and JavaScript connected to database tables.
I would understand if it is possible, by changing this code to display also immediately #info values (which already are saved correctly sending the page, it is only a display issue).
GreyHead 01 Mar, 2017
Hi agostinopol,

I'm sorry, but I now don't understand the question. Please explain exactly what data you have and what you need to do with it.

Bob
agostinopol 01 Mar, 2017
.
.
Sorry for my bad explanation



"codice" is a textbox with autocomplete from databases (Table aaa_tabella contains four fields: code, name, agent, manager).

name, agente, manager are normal textbox.

<?php
$db = \JFactory::getDBO();
$query = "
SELECT `nome`
FROM `aaa_tabella`
WHERE `codice` = '{$form->data['cliente']}' ;
";
$db->setQuery($query);
$form->data['nomecliente'] = $db->loadResult();
?>


This code calls in the textbox "name" the relative name but the textbox remains empty.

To save the name of the form is normally saves but I want to do it immediately see when I choose the code
GreyHead 01 Mar, 2017
Hi agostinopol,

I'm sorry but that doesn't help - I still have no idea where the name, agent, manager values are coming from :-(

Bob
This topic is locked and no more replies can be posted.