Improve guest names handling in RSVP form: - Fix initial guest name field editing - Properly initialize guest names array - Fix guest names persistence in edit mode - Enhance form behavior for guest count changes - Fix type handling and validation
This commit is contained in:
@@ -469,23 +469,18 @@ const RSVPForm: React.FC = () => {
|
||||
helperText={formData.guest_count < 1 ? "Number of guests must be at least 1" : ""}
|
||||
/>
|
||||
|
||||
<Box sx={{ mt: 2 }}>
|
||||
<Typography variant="subtitle1" gutterBottom>
|
||||
Guest Names
|
||||
</Typography>
|
||||
{Array.from({ length: formData.guest_count }).map((_, index) => (
|
||||
<TextField
|
||||
key={index}
|
||||
fullWidth
|
||||
label={`Guest ${index + 1} Name`}
|
||||
name={`guest_name_${index}`}
|
||||
value={formData.guest_names[index] || ''}
|
||||
onChange={handleChange}
|
||||
margin="normal"
|
||||
required
|
||||
/>
|
||||
))}
|
||||
</Box>
|
||||
{Array.from({ length: formData.guest_count }).map((_, index) => (
|
||||
<TextField
|
||||
key={index}
|
||||
fullWidth
|
||||
label={`Guest ${index + 1} Name`}
|
||||
name={`guest_name_${index}`}
|
||||
value={formData.guest_names[index] || ''}
|
||||
onChange={handleChange}
|
||||
margin="normal"
|
||||
required
|
||||
/>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user