ASPNET EF ‘Validation failed for one or more entities. See ‘EntityValidationErrors’ property for more details.’

Hola amigos estoy tratando de hacer un insert a mi bd , pero obtengo este error

‘Validation failed for one or more entities. See ‘EntityValidationErrors’ property for more details.’

Este es mi Insert

    [Authorize]     [HttpPost]     public ActionResult InsertRole(string role,string id_userCreated)     {          using (DBEnt db = new DBEnt())         {              var rolx = new AspNetRoles()             {                 Name = role ,              };             db.AspNetRoles.Add(rolx);             //db..add(cat);             db.SaveChanges();         }         var action = "Insert";         var comments = "Contadores ingresada por el usuario : ";         InsertInBitacora(id_userCreated, action, comments + id_userCreated);         return RedirectToAction("AdminRoles");     } 

Entinedo que me manda un error porque no le estoy pasando el ID, que junto con Name son los unicas columnas de mi tabla, quiero saber como puedo auto generar el famoso ID, que a todo esto es un nvarchar(128), tal como pasa como pasa cuando se inserta un user en la tabla [AspNetUsers]

When should an input validation border change?

When I was working on validation just now, I came up with a couple of questions with regard to validation. When should an input border’s color change?

  • When should it turn from (a default or) no color to e.g. a green-colored border?
  • when should it turn from (a default or) no color to e.g. a red-colored border?
  • When should it turn from e.g. a red-colored border to e.g. a green-colored border?

Most of the time I see that either the input’s border color changes on the submition of the form or when the input’s value changes (see below as an example).

Example

Isn’t changing the color on the submition too late?

Isn’t changing the color on input’s value change too broad? (What about if I fill in a number inside a text input field, the border will change from red to green whilst the value inside related input is actually, in fact, invalid?)

Is there any best practice or are there any guidelines for the handling of input validation when it comes to user experience?

What does IIS query string validation protect from?

Recently we had a failure in one of our systems because IIS rejects query strings with (URL encoded) parameter values containing the sequence &#. It doesn’t reject & #.

We’ve got tired of working around this limitation (e.g. user types a formula for a rule they want evaluated, we have to work around encoding less than and greater than signs, but I can’t see a full list of things we are not allowed to have as a parameter, so every now and then a user can’t do something legitimate because the request 500s).

We are considering turning it off completely ( setting requestValidationMode to 0.0 ) but don’t know what it’s actually protecting us from.

Is the first one protecting against something important that is not triggered by the second? We don’t put user inputs unencoded into HTML or intersperes them into SQL text or anything silly.

Form input – Follow expected sequence or offer field validation?

Validation opposed to expectations

My team proposed to change the usual sequence of an address form. They want to put the country before the other address fields so they can validate the following fields depending on the selected country. The con is however that this deviates from the mental model of the users and it will slow down the data entry and might be slightly annoying.

Some users will enter addresses a few times a day, others not so often.

What solution is the best?

address from field sequence

Having a code-signed binary, how can I tell if it’s signed with an Extended Validation (EV) certificate?

I can’t seem to find an answer to this seemingly simple question. Say, on Windows, if I have a binary file:

enter image description here

How can I tell if it was signed with an extended validation (EV) code-signing certificate?

Say, the file above, being a Windows driver on a 64-bit Windows 10 has to have an EV signature to be able to load. So I can’t seem to find anything in its properties that can indicate that it’s an EV:

enter image description here

And since the OS can clearly tell the difference between EV and OV cert, how does it know?

Infopath 2013 validation error message about a missing field

Currently testing a Sharepoint list form customized in Infopath.

Once I’ve been through the whole – long- form in Sharepoint, and click on ‘submit’ the form returns a message error that reads:

Warning

The form cannot be submitted because it contains validation errors. Errors are marked with either a red asterisk (required fields) or a red, dashed border (invalid values). Field or group: my:CoI Error: Cannot be blank
Click OK to resume filling out the form. You may want to check your form data for errors. An error occurred while using the form. For more information, contact the site administrator.

An entry has been added to the Windows event log of the server.

Log ID:5567

Correlation ID:84bbac9d-903a-3000-a1e2-23725f992595

The issue is, when I check for the control ‘CoI‘ in Infopath Designer, I cannot find it in the list of fields, either in basic or advanced view.

How is it possible to solve that validation error?

I have a vague feeling this question was already asked, but cannot get hold of it.

Apologies if that’s already been asked, and happy to pull the question if the answer is already available here.

Gender based validation

I’ve a Leave form in SharePoint list. when a female logins with her credentials, she can be able to see ‘Maternity leave’ drop down. Whereas, when a male candidate logins with his credentials, he should not be able to see ‘Maternity leave’ from drop down option. Can any one please help how to differentiate the gender using Js/ Jquery? (Based on Current logged in user)

Can i prevent modifying 2 fields when editing a list item using list validation

I am working on a custom list inside a classic team site. and inside the edit form i added this jQuery code to disable 2 fields (so those fields will only be set when creating the item):-

$  ("input[id^='ESTCompletion']").attr('disabled', 'disabled'); $  ("input[id^='Completion']").attr('disabled', 'disabled'); 

enter image description here

but since the users can disable javascript and bypass the validation and modify these fields..

so can i write a validation rule inside the list validation to make sure that those 2 date fields will not be modified when editing the item?

In the on-premises farm, i use to write an item-updating event receiver to do such checks, but in the online world implementing those will require lot of efforts and hosting cost.. so i was thinking if i can do these checks inside the list validation?

Is it possible to crack a CRC value for short text validation when someone tries to change a readable text?

I’d like to validate message texts with CRC-8/16/32 but I’m afraid that they could be changed to another one (for example, adding a “No” at the beginning). There will be no special characters besides the usual ones (? , . ; ª º + =…) and the number of bytes will be counted as well. The messages will not be encrypted.

Item Validation error message customization

I have a question regarding SharePoint item validation. Is there a way to customize how the error message from item validation is rendered? For example, to apply some CSS, or to alter it’s placement on the page? I have researched this but cannot seem to find an answer on how to do this while keeping item validation? I know forms can be customized and we can use CSR validation, but that then bypasses if a user decides to use Quick Edit.

Any help or a direction would be very appreciated.

Thanks,