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.

After Browse

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

After Browse

Unread post by ricklincs »

On a Lookup object I use after browse to set the following Form Values

Code: Select all

nuSetFormValue('reg_no', nuLookUpRecord()->stk_reg_no);
nuSetFormValue('date_in', nuLookUpRecord()->stk_date_in);
nuSetFormValue('time_in', nuLookUpRecord()->stk_time_in);
nuSetFormValue('vehicle_type', nuLookUpRecord()->stk_vehicle_type);
nuSetFormValue('customer', nuLookUpRecord()->stk_customer);
nuSetFormValue('company', nuLookUpRecord()->stK_company);
nuSetFormvalue('vehicleinin_id', nuLookUpRecord()->vehicleinid_id);
all of these work apart from the 2nd one. date_in always remains blank. The date_in object is type input nuDate and the format is dd-mm-yy in mysql the field is type Date showing 2025-08-19. The LookUpRecord stk_date_in object is type input nuDate and the format is dd-mm-yy in mysql the field type is Date showing 2025-08-19.

Is there something with nuDate that means I can't use this in After Browse?

Thank you.
kev1n
nuBuilder Team
Posts: 4461
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 75 times
Been thanked: 495 times
Contact:

Re: After Browse

Unread post by kev1n »

Try converting the date:

// Convert MySQL date (YYYY-MM-DD) to dd-mm-yy to match the date of the date_in object
$dateInFormatted = date('d-m-Y', strtotime($record->stk_date_in));

// Set the form value
nuSetFormValue('date_in', $dateInFormatted );
ricklincs
Posts: 116
Joined: Mon Aug 01, 2011 5:39 pm
Has thanked: 36 times

Re: After Browse

Unread post by ricklincs »

Sorry Kev1n, where should I put "$dateInFormatted = date('d-m-Y', strtotime($record->stk_date_in));"
kev1n
nuBuilder Team
Posts: 4461
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 75 times
Been thanked: 495 times
Contact:

Re: After Browse

Unread post by kev1n »

Code: Select all

$dateInFormatted = date('d-m-Y', strtotime(nuLookUpRecord()->stk_date_in));
nuSetFormValue('date_in', $dateInFormatted );

nuSetFormValue('reg_no', nuLookUpRecord()->stk_reg_no);
nuSetFormValue('time_in', nuLookUpRecord()->stk_time_in);
nuSetFormValue('vehicle_type', nuLookUpRecord()->stk_vehicle_type);
nuSetFormValue('customer', nuLookUpRecord()->stk_customer);
nuSetFormValue('company', nuLookUpRecord()->stK_company);
nuSetFormvalue('vehicleinin_id', nuLookUpRecord()->vehicleinid_id);
ricklincs
Posts: 116
Joined: Mon Aug 01, 2011 5:39 pm
Has thanked: 36 times

Re: After Browse

Unread post by ricklincs »

Hi kev1n, yes tried that and I get Pop Up Before Browse of Object knownvehicle on Form VehicleOut Error [2]: Undefined variable $record in /var/www../core/nucommon.php(1535) : eval()'d code on line 1
kev1n
nuBuilder Team
Posts: 4461
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 75 times
Been thanked: 495 times
Contact:

Re: After Browse

Unread post by kev1n »

code above corrected :)
Post Reply