fluent ui nortstar FormDropdown make it required field - microsoft-teams

how can we make the the dropdown in the Nortstar Form as a required field?
is it possible to do so ?
in the Fluent ui Form for the textarea and input component we have required Field so onsubmit it validates the input Form shows to fillout for required fields
https://codesandbox.io/s/zgpqse?module=/example.js
But for dropdown we don't have anything as such. how do we validate the Dropdown with required field?
we can disable the submit button based on hooks but it would be good if we have a required field
https://codesandbox.io/s/cokfqy?module=/example.js

Related

Vee-validate - Triggering field level validation only when $validator.validateAll() is called but not when the input field is touched

I have a scenario where a custom field validation rule to be triggered only when the submit button is clicked for that form and it should be triggered by calling $validator.validateAll() function itself. I don't want this rule to be triggered when I start making changes to the input field.
I have looked into .disable directive but looks it it will disable all the validation rules for that field which I don't want. I want to disable a specific validation rule and enable it later on the button click.
I am using vee-validate version 2.xx.
try dynamic validation in vee validate.
Dynamic Rules

How to customise react-final-form record and field validation?

There is a few question I wish to ask about react-final-form.
How can I prevent form auto call validate on form init? I try to have a work around to skip it by check if form is dirty or pristine and it resume its original behavior once a field is changed. The problem is I not able to get the meta in record validation.
<Form
validate={value => {
const errors = {};
// if (!meta.dirty) return errors;
... continue validation
}
render={}
/>
How can I programmatic call form/record level validate without touching any field?
Instead of record level validation, I have field level validate with validateFields and for each field to prevent full validation (I have a lot of AJAX call for each field validation) when only 1 field change. But I need to fire all field validation when I click submit button. Is there a way to fire all field validation at once?

Conditional Aurelia Validation on Visibility of Element

I'm trying to work out some license subscription form with aurelia and aurelia validation plugin.
I have a fieldset for personal information where most of them are required and get validated by aurelia validation.
Now I also have a fieldset for credit card information and for billing address with also fields that are required and validated. The thing is, they only get displayed when the user picks the subscription radio button.
I have all the required fields in the ValidationRules, how can I tell aurelia that it should only validate the ones that are currently visible?
You can use conditional validation with the when fluent method. Here is an example from the Aurelia Docs.
ValidationRules
.ensure('email')
.email()
.required()
.when(order => order.shipmentNotifications)
.withMessage('Email is required when shipment notifications have been requested.');
If you use if.bind on your element, the hidden element will not get validated.
Unless you want the element in your DOM but only hidden, use if.bind.
That way, your element is not rendered in dom, so not validated.
show.bind -> hide/show element
if.bind -> render/not render element

Kendo Ui Form Validation: Use field title in validation message

I am using Kendo Popup grid and notice that the validation message for all the fields that are set to required appear as "{field} is required". I want to be able to use the "Title" field of the model instaed of the fieldname. Is there an easy way for this?
As per Kendo forum http://demos.kendoui.com/web/validator/index.html : I need to specify the error message individually for all the fields which is not a good solution(IMHO).
Currently this is not supported out of the box. You need to set the validation message via the validationMessage attribute.

How to disable data annotation required field validator in MVC

I am trying to design a page that has two radio button options and two text boxes with each radio button. I am validating these text boxes using data annotation validation attribute.
I am using jquery slider.toggle() to display each text boxes according to the radio button clicked. When i submit the page, required field validators of both text boxes are triggered. What I want to do is to disable the first text box validation when the second radio button is clicked.
Is there any method in MVC to disable the validation of text boxes when the radio button associated to it is not selected?
This can be done rather simply front end. The validation which occurs is done based on html5's data attribute. Remove the data attributes from an input element and the validation will cease to function.

Resources