Welcome to the nuBuilder Forums!

Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.

html object that gets value from procedure

Questions related to using nuBuilder Forte.
Post Reply
ricklincs
Posts: 121
Joined: Mon Aug 01, 2011 5:39 pm
Has thanked: 41 times

html object that gets value from procedure

Unread post 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.
kev1n
nuBuilder Team
Posts: 4581
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 536 times
Contact:

Re: html object that gets value from procedure

Unread post 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);
ricklincs
Posts: 121
Joined: Mon Aug 01, 2011 5:39 pm
Has thanked: 41 times

Re: html object that gets value from procedure

Unread post by ricklincs »

Thanks again Kev1n
Post Reply