Unable to access an error message corresponding to your field name Email Address.(is_uniqe) - codeigniter-3

$this->form_validation->set_rules('uemail', 'Email Address', 'required|trim|valid_email|is_uniqe[users.email]');

Related

How can I access Country Name in ISO formate from ReactivePhoneFormField<PhoneNumber> widget?

How can I access Country Name or Nationality from the following after a country iso is selected by the user:
ReactivePhoneFormField<PhoneNumber>(
defaultCountry: IsoCode.GB,
decoration: InputDecoration(
labelText: 'Contact number', border: OutlineInputBorder()),
formControlName: 'phoneNumber',
// selectionHeightStyle: BoxHeightStyle.max,
// showFlagInInput: true,
//TODO? Phone verification. After signup?
/* validationMessages: (control) => {
ValidationMessage.required:
'Please provide your contact phone number',
'phoneNumber': 'Please enter a valid contact number'
},*/
countrySelectorNavigator:
CountrySelectorNavigator.modalBottomSheet(
favorites: [IsoCode.GB, IsoCode.ZA, IsoCode.US]),
),
As well , do tell that which of the following (onSaved,onSubmitted,onTap,onEditingComplete) functions available in this widget provide the samefunctionality as of onChanged function of textfield!

Use form_validator to check that the email is the same

I'm using the form_validator Flutter plugin to create a form block.
My form contains contains a lot of fields including Email and Email confirmation:
TextFormField(
validator: ValidationBuilder()
.email()
.maxLength(50)
.required()
.build(),
decoration: const InputDecoration(labelText: 'email'),
),
const SizedBox(height: 30),
TextFormField(
validator: ValidationBuilder()
.email()
.maxLength(50)
.required()
.build(),
decoration:
const InputDecoration(labelText: 'email confirmation'),
),
They are equals, the only thing that changes is the label. How can I add a check to the second field (EMAIL CONFIRMATION) that controls that it's the same value of the first one?
Example:
EMAIL: john.snow#gmail.com
EMAIL CONFIRMATION: john.snow#gmail.com
--> ok
EMAIL: john.snow#gmail.com
EMAIL CONFIRMATION: harry.potter#gmail.com
--> error
You could simply use 2 text controllers like say,
emailTextController
confirmEmailTextController
Make sure you add the following validator method in the Confirm Email TextFormField
validator: (value) {
if (value != emailTextController.text) {
return 'Email is not matching';
}
},
And you get the respective errorText, whose fontStyle can be adjusted.

How to create multiple password checks validation with Yup and RHF?

How to create multiple password checks validation with Yup and RHF?
I have register yup schema and i wanna to add multiple password checks validation like in the nike.com
export const RegisterSchema = yup.object().shape({
email: yup.string().email('Please enter a valid email address.').required('Email is a required field.'),
password: yup
.string()
.required('required')
.min(8, 'Minimum of 8 characters')
.matches(RegExp('(.*[a-z].*)'), '1 lowercase letter')
.matches(RegExp('(.*[A-Z].*)'), '1 uppercase letter')
.matches(RegExp('(.*\\d.*)'), '1 number'),
firstName: yup
.string()
.matches(/^([^0-9]*)$/, 'First name should not contains numbers.')
.max(40, 'First name cannot exceed 40 characters.')
.required('Please enter a first name.'),
lastName: yup
.string()
.matches(/^([^0-9]*)$/, 'Last name should not contains numbers.')
.max(40, 'Last name cannot exceed 40 characters.')
.required('Please enter a last name.'),
dateOfBirth: yup.string().required('Please enter a date of birth.'),
country: yup.string().required('Please enter a country.'),
gender: yup.string().required('Please select a preference.'),
})
You've to use the criteriaMode: 'all' option with useForm.
https://react-hook-form.com/api/useform/[![criteriaMode option]1]1
Here is a working example (v7):
👉🏻 https://codesandbox.io/s/react-hook-form-v6-errors-validatecriteriamode-all-p9xm6

Translate custom validationErrorMessages in typo3 forms with locallang.xlf

I use locallang.xlf to translate my form (typo3 9.5.5, formextension).
my customform.yaml:
renderables:
-
properties:
fluidAdditionalAttributes:
required: required
validationErrorMessages:
-
code: 1221560910
message: 'My Custom Message'
code: 1221560718
message: 'My Custom Message'
-
code: 1347992400
message: 'My Custom Message'
-
code: 1347992400
message: 'My Custom Message'
options:
products: 'Products'
miscellaneous: 'Sonstiges'
prependOptionLabel: 'Please Specify'
type: SingleSelect
identifier: subject
label: 'Your Subject:'
validators:
-
identifier: NotEmpty
-
my locallang.xlf:
<trans-unit id="element.subject.properties.prependOptionLabel">
<source>Please Specify --Works!</source>
</trans-unit>
<trans-unit id="element.subject.properties.options.products">
    <source>Products --Works!</source>
</trans-unit>
<trans-unit id="element.subject.properties.validationErrorMessages.message">
<source>Custom Message -Doesn't work!</source>
</trans-unit>
With an exact translation key it works, except validationErrorMessages.
Does anyone know how to translate these?
You can use the following translation keys for validation error codes. 1221559976 is the code for the EmailAddress validator:
<trans-unit id="validation.error.1221559976">
<source>Please enter valid email address. Thanks!</source>
<target>Bitte gebe eine gültige E-Mail-Adresse ein. Danke!</target>
</trans-unit>
<trans-unit id="MyContactForm.validation.error.1221559976">
<source>Please enter valid email address. Thank you very much!</source>
<target>Bitte gebe eine gültige E-Mail-Adresse ein. Vielen herzlichen Dank!</target>
</trans-unit>
The latter will override the first, as it contains the form identifier and is therefore more specific.
Keep in mind that both of these translation keys will not work if you already set a custom message in your form definition!
This means, the last three lines of the following example have to be removed:
renderables:
-
defaultValue: ''
identifier: email
label: Email
type: Text
properties:
fluidAdditionalAttributes:
placeholder: 'Email address'
### Don't set this if you want to translate the message:
#validationErrorMessages:
# - code: 1221559976
# message: 'Please enter a valid email address, dear.'

Unable to send email with boto3 pinpoint send_messages - need example

I have a validated domain, and sending a direct email via the AWS Pinpoint console works fine. However, I can't get the same to work with Boto3 send_messages.
I get {'DeliveryStatus': 'PERMANENT_FAILURE', 'StatusCode': 400, 'StatusMessage': 'Request must include message email message.'}
But I have a MessageConfiguration Default Message with a simple string for Body, and I've tried BodyOverride as well. No problems sending SMS.
I've been unable to snag an example of send_messages, and I think if I saw a working example of an email send, that'd be all I need.
Snippet:
response = ppClient.send_messages(
ApplicationId=pinpointId,
MessageRequest={
'Addresses': {
'mguard#{validateddomain}.com': {
# 'BodyOverride': 'Hello from Pinpoint!',
'ChannelType': 'EMAIL',
}
},
'MessageConfiguration': {
'DefaultMessage': {
'Body': 'Default Message for EMAIL.',
'Substitutions': {}
}
}
}
)