Page 1 of 1

After Browse

Posted: Fri Sep 12, 2025 3:09 pm
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.

Re: After Browse

Posted: Fri Sep 12, 2025 3:14 pm
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 );

Re: After Browse

Posted: Fri Sep 12, 2025 3:38 pm
by ricklincs
Sorry Kev1n, where should I put "$dateInFormatted = date('d-m-Y', strtotime($record->stk_date_in));"

Re: After Browse

Posted: Fri Sep 12, 2025 3:41 pm
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);

Re: After Browse

Posted: Fri Sep 12, 2025 3:54 pm
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

Re: After Browse

Posted: Fri Sep 12, 2025 3:59 pm
by kev1n
code above corrected :)