I can't find out where is the error in my form.
I have a select of two items and an input for each of them.
When I choose one of the items my form myform.$error shows {"myform":[null]} when I input some variable it show {} - my form is good.
I can't find what does this expression mean: {"myform":[null]}
Related
I have a list of entities all of which are arranged in a virtualized list sporting 2 required Textfields and a submit button each. (I followed the example provided here).
In useForm() I set the validation mode to 'onChange'.
This setup only kinda works. The validation does happen but the errors are not shown immediatley. Instead only after I start typing is the (now obsolete) error displayed.
Another problem is, that RHF doesn't call the onSubmit function even if there are no validation errors.
Here is a CS showcasing the problem:
https://codesandbox.io/s/hopeful-chatterjee-571glh?file=/src/App.js
I am using ColdFusion 2016. I have a form with a multi-select drop down. The name attribute of the field is called jobRoleId. When I submit this form the field name is available in the form scope as jobRoleId[]. How do I get the value of this field? The name comes across like an array but I can't seem to just dump out the value due to the brackets.
I've tried dumping out the value, but I get an error. I feel like I have done this in the past and the form field name didn't contain the brackets [] after the field name when using a multi select menu:
<select id="jobRoleId" name="jobRoleId" multiple="multiple">...</select>
Is there a way to somehow have the form field name just come across as jobRoleId?
writedump(jobRoleId[]);
abort;
When I execute your code I get a comma separated list for the values of jobRoleId. Are you using any CF frameworks?
My output:
I also suggest looking at the client side JavaScript to confirm there's nothing changing the submitted name. You can use the Chrome/Firefox/IE debugger to watch your submissions and confirm what is being submitted
Multi select lists, in CF, should return a list of values, as far as I remember...
A problem of the Validator class is that it validates all the inputs to which a constraint is added (that means that an error message is shown in not already filled inputs or selected pickers):
Validator val = new Validator();
val.addConstraint(title, new LengthConstraint(2));
val.addConstraint(price, new NumericConstraint(true));
In this example, the validator will show an error for both title and price even if the user didn't entered a price yet.
It would be more intuitive that an error is shown only after the user has given the input, that means to show an error for the price only after that a price is given.
I didn't find a code to implement this behavior.
My first thought was just create a validator which will check if something was modified and add it to the validation chain. However, that would mean the input could be valid if you didn't enter everything.
This is a feature that should be implemented in the rendering logic for this class. In Validator itself. You can file an RFE for that or just implement it in a pull request.
I'm using the Angular framework with Angular Material controls in my recent application. I'm looking for a good solution for the following problem:
A form form with an input field named nickname is shown to the user. After the user has chosen a nickname and submitted the form, the server checks whether the nickname has already been taken. In that case, it returns an error to the Angular client.
To show an appropriate error to the user, the code then calls form.nickname.$setValidity('nicknameTaken', true). The new ngMessages module is used to display the error to the user. Further form.$isInvalid is used to disable the form controls to prevent the user from resubmitting the invalid nickname.
My problem is now the following: I'd like to have the error nicknameTaken automatically being removed as soon as the user begins to edit the form fields again. What is a good way to do this? Is there a predefined route to go when it comes to server-side validation errors of this kind? (Note that I am not asking for asynchronous validation because I only want to contact my server when the form is actually being submitted.)
I would write a normal validator directive instead. Something like
<input blacklist="takenNickNames" .../>
This directive would simply add a validator to the input, and this validator would make the input invalid if the model value is contained inside the given takenNickNames array (and valid if it's not present).
The takenNickNames array would be empty initially. When the form is submitted and the error comes back, the controller would add the invalid nick name to the array.
So, every time the user would enter something, the validator would be triggered, and would set the field valid or not, based on the taken nicknames stored in the array.
Here is a working example.
i am having three require field coloumns in sharepoint list .when i try to add/edit item in newform.aspx/editform.aspx .. i'm getting error message as 'you must specify the value for required field' for all the three coloumn.
How can i customize the require field error messages in Newform.aspx/Editform.aspx..?
Thanks in advance ...!!!
Two Steps to proceed the custom validation for the required field used in SharePoint List item:
Go to List Settings -> Validation Settings, Enter the formula to validate the required column in Formula box and Custom Error message in User Message box for particular column.
Go to List Settings -> Choose your required column under Columns section and expand the Custom Validation and edit the formula, error message for that column. Click Save.
It will works.....