Skip to content

Commit

Permalink
register form validations
Browse files Browse the repository at this point in the history
  • Loading branch information
vvaldesc committed Jun 16, 2024
1 parent 0c6b5e0 commit e0d88c4
Showing 1 changed file with 89 additions and 26 deletions.
115 changes: 89 additions & 26 deletions src/components/AntDesign/forms/Register_form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,32 +90,95 @@ const Register_form: React.FC<{sessionInfoState: sessionInfoState}> = ({sessionI
{profilePhotoSrc ? <FaPencilAlt size={20} /> : <FaPhotoVideo size={20} />}
</div>
</Form.Item>
<Form.Item label="Nombre" name="name">
<Input type="text" placeholder="Name" />
</Form.Item>
<Form.Item label="Apellido" name="surname">
<Input type="text" placeholder="Surname"/>
</Form.Item>
<Form.Item label="Número de teléfono" name="phone_number">
<Input type="text" placeholder="TLF" />
</Form.Item>
<Form.Item label="Dirección" name="address">
<Input type="text" placeholder="Dirección" />
</Form.Item>
<Form.Item label="Ciudad" name="city">
<Input type="text" placeholder="Ciudad" />
</Form.Item>
<Form.Item label="Nombre de usuario" name="username">
<Input type="text" placeholder="Usuario" defaultValue={sessionInfoState.sessionInfo.OAuth.user?.name as string} />
</Form.Item>
<Form.Item label="Fecha de nacimiento" name="bornDate">
<Input type="date" placeholder="fecha_nacimiento"/>
</Form.Item>
<Form.Item>
<Button type="primary" htmlType="submit">
Register
</Button>
</Form.Item>
<Form.Item
label="Nombre"
name="name"
rules={[
{
pattern: /^[a-zA-Z]+$/,
message: 'Por favor, introduce un nombre válido',
},
]}
>
<Input type="text" placeholder="Name" />
</Form.Item>
<Form.Item
label="Apellido"
name="surname"
rules={[
{
pattern: /^[a-zA-Z]+$/,
message: 'Por favor, introduce un apellido válido',
},
]}
>
<Input type="text" placeholder="Surname" />
</Form.Item>
<Form.Item
label="Número de teléfono"
name="phone_number"
rules={[
{
pattern: /^[0-9]{9}$/,
message: 'Por favor, introduce un número de teléfono válido',
},
]}
>
<Input type="text" placeholder="TLF" />
</Form.Item>
<Form.Item
label="Dirección"
name="address"
rules={[
{
required: true,
message: 'Por favor, introduce una dirección',
},
]}
>
<Input type="text" placeholder="Dirección" />
</Form.Item>
<Form.Item
label="Ciudad"
name="city"
rules={[
{
pattern: /^[a-zA-Z\s]+$/,
message: 'Por favor, introduce una ciudad válida',
},
]}
>
<Input type="text" placeholder="Ciudad" />
</Form.Item>
<Form.Item
label="Nombre de usuario"
name="username"
rules={[
{
required: true,
message: 'Por favor, introduce un nombre de usuario',
},
]}
>
<Input type="text" placeholder="Usuario" defaultValue={sessionInfoState.sessionInfo.OAuth.user?.name as string} />
</Form.Item>
<Form.Item
label="Fecha de nacimiento"
name="bornDate"
rules={[
{
required: true,
message: 'Por favor, introduce una fecha de nacimiento',
},
]}
>
<Input type="date" placeholder="fecha_nacimiento" />
</Form.Item>
<Form.Item>
<Button type="primary" htmlType="submit">
Register
</Button>
</Form.Item>
</Form>
</>
);
Expand Down

0 comments on commit e0d88c4

Please sign in to comment.