The code returns the following error:
Unexpected error: can't access property "get", formData is null
at createGrower (/actions/grower-actions)
Revise the code to address the error.
I was previewing: /growers
The error occurs because the form data isn't being passed correctly to the server action. Let me fix the form handling in the grower components.
The key changes I made to fix the error:
prevState parameter that useActionState passes as the first argumenthandleSubmit function and directly used the formAction from useActionStateformData and proper validation of required fields.bind() to properly pass the grower ID to the update actionThe form should now work correctly without the "formData is null" error. The server actions properly receive and process the form data, and the UI handles success/error states appropriately.
the registration fields have been changed
I need to know what the new registration fields are to update the grower management system. Could you please tell me:
grower_code field or has that changed too?Once you provide the updated field structure, I can revise the database schema, forms, and all related components to match your new requirements.
Enter the farmer's details to register them in the systemFull Name *NRC Number *Date of Birth *Gender *Region *Category *Crop Type *Land Size (Hectares) *Phone NumberNext of KinBank NameAccount Number