Update help-block of non-modified Yii2 ActiveFields with AJAX validation - ajax

There is a case in my Yii2 ActiveForm (validated with AJAX) where the validation result for a field X depends on the value of another field Y.
My intention is to have the validation error help-block appearing only next to X. The problem is that when I modify field Y no update is taking place in regards to the help-block of X. It seems that only the modified field can have its help block updated via AJAX.
Is it possible to force update of all help-blocks in the form after AJAX validation?

Related

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?

How can i get data from database for dropdownlist in Form in Laravel using laravel collectives?

I have used usual dropdown list and it's not worked,
when i click the submit button for all the data in the form except drop down value were sent to database.how can i fix it??
Your <select> is missing a name="foo" attribute.
A form will only submit elements with a name as part of the request.

How to trigger input's property required on HTML5?

My question is about how can I trigger the validation of required property without using the submit button
More or less I big a huge form, that is divide by a slider(steps), but is just one form. The point is, that form implement ajax at the end to submit the information that is serialize manually with javascript. So the problem is that the required (attribute, property) is not working, so you have to make the rule for empty input manually. I think is a waste, if you can do that with required.
So I want to bind every slide, to the required inputs.
Thank you in advance
Have you tried checkValidity() ( http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#dom-cva-checkvalidatity )?

codeigniter form prepopulation

Is there a method to prepopulate a certain field in a form using data from the previous page using codeigniter.
I have a page with input fields that are filled out, if the user presses a "add" button they are given a new form with similar fields. I want those fields to be populated from data received by the previous page.
You can use CI's form helper function set_value() which uses the $_POST and may save you some code testing if the $_POST value is empty because you can specify a default value if not set. Should be using this anyway if your using CI's form validation.
Can't you simply use the $_POST data to display the second form?
You could store the data entered in form 1 in sessions or in the database and display it in the second form. Or as mentioned use $_POST in the second form to retrieve submitted data from the previous.

Selected Dropdown value changes when validation fails-ASP.NET MVC

I am using MVC 3 with ASP.NET. I have a dropdown box and getting it populated from database. I am using validation on the View. If it fails the validation, I am displaying the same view with errors being caught in ViewDate.ModelState.AddModelError.
I am checking for the ViewData.Modelstate.IsValid property if true then execute the code else display the errors in the view.
It is diplaying the errors in the page, but the selected value in the drop down is getting reset when validation fails.
How do I make sure the seleceted drop down does not change when validation fails?
In the action that handles the form submission and validation, make sure you set the properties on your model object from the form before rendering the form view.
For example, in this question you can see how the Dinner object parameter in the Create action is reused when the View() is returned.
Set a breakpoint in the action handling the submission and check the property for the list of values. If it's null or empty reload it.
If your dropdownlist is being populated via javascript then it is possible that the property holding the list of values is empty on submission. This is common when using cascading dropdownlists such is the case with loading Province / State lists based off country. All cascading lists loaded after the model has been passed to the view must be reloaded using the selected value of for each dropdownlist in the controller action that is handling the submission.

Resources