Page 1 of 1

html object that gets value from procedure

Posted: Fri Aug 22, 2025 5:31 pm
by ricklincs
I have a html object on a launch form called vehicleins_today which has html of :

Code: Select all

<div id="vehicleins_card" style="
    background: linear-gradient(135deg, #4e73df, #224abe);
    color: white;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    font-family: Arial, sans-serif;
    width: 250px;
    margin: auto;
">
    <h3 style="margin: 0; font-size: 18px;">Total VehicleIns Today</h3>
    <h1 id="vehicleins_total" style="margin: 10px 0; font-size: 40px;">0</h1>
</div>
I have a procedure called get_vehicleins_today whos php is:

Code: Select all

$sql = "SELECT COUNT(*) AS total FROM vehiclein WHERE DATE(date_in) = CURDATE()";
$r = nuRunQuery($sql);
$o = db_fetch_object($r);
echo (int)$o->total;
How do I call the procedure to pass the value to my html object? On Form Launch or custom code nuonLoad ? That's if procedure is correct.
Thanks in advance.

Re: html object that gets value from procedure

Posted: Fri Aug 22, 2025 9:40 pm
by kev1n
In the PHP BE (Before Edit) event, add:

Code: Select all

$sql = "SELECT COUNT(*) AS total FROM vehiclein WHERE DATE(date_in) = CURDATE()";
$r = nuRunQuery($sql);
$o = db_fetch_object($r);

$js = "nuSetValue('vehicleins_total','$o->total','html');";
nuAddJavaScript($js);

Re: html object that gets value from procedure

Posted: Fri Aug 22, 2025 11:43 pm
by ricklincs
Thanks again Kev1n