I am a completely newbie in AppGini.
I am starting to build a simple app.
I have a invoice counter field in detail view.
Based on invoice type selection (1), upon pressed the "Get invoice counter" hyperlink (2), must retrieve its counter from database and update this field (3). I tried the following code:
Code: Select all
function invoices_dv($selectedID, $memberInfo, &$html, &$args)
{
// if record exists, don't get its counter
if ($selectedID)
{
return;
}
else
{
ob_start();
echo "<h4><a href='javascript:calculate_counter()'>Get invoice counter</a></h4>";
?>
<script>
function calculate_counter()
{
var inv_type = $j('#inv_counter').val();
var sql_string = "SELECT `counter` FROM `invoice_types` WHERE `id` = '" + inv_type + "';";
alert(sql_string);
}
</script>
<?php
$form_code = ob_get_contents();
ob_end_clean();
$html .= $form_code;
}
}
Ideally, I want to add a custom button (4) next to invoice counter field, instead of hyperlink.