-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new input preferred_client_id
to ClientCreateContainer
#7
Conversation
@Pe5h4 can you review pls?) |
public/locales/cs/translation.json
Outdated
@@ -133,6 +134,7 @@ | |||
"ClientFormField": { | |||
"Add new input": "Přidat pole", | |||
"Remove input": "Odstranit pole", | |||
"Invalid format, should have minimum of 8 characters": "Nesprávný formát, musí mít minimálně 8 znaků", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aringoaway "Invalid format, input should have minimum of 8 characters": "Nesprávný formát, pole musí mít minimálně 8 znaků"
public/locales/en/translation.json
Outdated
@@ -133,6 +134,7 @@ | |||
"ClientFormField": { | |||
"Add new input": "Add new input", | |||
"Remove input": "Remove input", | |||
"Invalid format, should have minimum of 8 characters": "Invalid format, should have minimum of 8 characters", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aringoaway "Invalid format, input should have minimum of 8 characters":"Invalid format, input should have minimum of 8 characters"
@@ -108,6 +108,10 @@ const ClientCreateContainer = (props) => { | |||
body.client_name = ""; | |||
} | |||
|
|||
if (body.preferred_client_id == "") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aringoaway I think you want to check for undefined here as well
name, | ||
(name == "preferred_client_id") && { | ||
validate: { | ||
validation: value => (/^[-_a-zA-Z0-9]{8,64}$|^$/).test(value) || t("ClientFormField|Invalid format, should have minimum of 8 characters"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aringoaway As per my comment in locales Invalid format, input should have minimum of 8 characters
validate: { | ||
validation: value => (/^[-_a-zA-Z0-9]{8,64}$|^$/).test(value) || t("ClientFormField|Invalid format, should have minimum of 8 characters"), | ||
} | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aringoaway Remove comma here
onChange={reg.onChange} | ||
onBlur={reg.onBlur} | ||
innerRef={reg.ref} | ||
|
||
invalid={(errors?.preferred_client_id) && errors.preferred_client_id} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aringoaway invalid={errors.preferred_client_id && errors.preferred_client_id}
should be enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Pe5h4 I tested it and ?
here it is necessary => invalid={errors?.preferred_client_id && errors.preferred_client_id}
/> | ||
{(errors?.preferred_client_id) && <FormFeedback>{errors.preferred_client_id?.message}</FormFeedback>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aringoaway `{errors.preferred_client_id && {errors.preferred_client_id?.message}}
should be enough, but please test that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Pe5h4 I tested it and ?
is aslo here is necessary {errors?.preferred_client_id && <FormFeedback>{errors.preferred_client_id.message}</FormFeedback>}
This is a check that should be here. Because I use this component for different inputs and only this input preferred_client_id
has an error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aringoaway Minor change in wrapping conditions, pls fix first and then you can merge it
@@ -108,6 +108,10 @@ const ClientCreateContainer = (props) => { | |||
body.client_name = ""; | |||
} | |||
|
|||
if (body.preferred_client_id == "" || body.preferred_client_id == undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aringoaway wrap conditions ((body.preferred_client_id == "") || (body.preferred_client_id == undefined))
Add new input
preferred_client_id
to ClientCreateContainer.This is an optional field. If it's empty, request won't send anything.
new-input.mp4