Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

igValidator cannot be applied to input type=radio with dot in 'name' attribute #2233

Open
RivaIvanova opened this issue Jul 7, 2023 · 0 comments

Comments

@RivaIvanova
Copy link
Member

Description

Consider the following:

<div>
  <label>First name*</label>
  <input type="text" id="firstName" />
</div>
<div>
  <input id="radioyes" type="radio" name="radio.button" value="Yes" />
  <label for="radioyes">Yes</label>
</div>
<div>
  <input id="radiono" type="radio" name="radio.button" value="No" />
  <label for="radiono">No</label>
</div>
$("#validationForm").igValidator({
  onsubmit: true,
  successMessage: "Valid",
  fields: [
    {
      selector: "#firstName",
      required: true,
      onblur: true,
    },
    {
      selector: "#radiono",
      required: true,
      onchange: true,
    },
  ],
});

Setting the name attribute to radio.button or any other value that contains a dot throws an exception and other input fields are marked as valid even though they are set as required and no value is provided.
Names like radio-button or radio_button are acceptable.

button

input

Note
This could be due to the _findGroupTargets function which is used in _initializeField.

  • ignite-ui version: 22.2
  • browser: any

Steps to reproduce

  1. Open this demo
  2. Click on the different inputs -> The "Valid" success message is displayed although all fields are required.
  3. Open the Dev Console Tool -> An error is thrown.

Result

Setting the name attribute to a radio.button throws an error.

Expected result

No error should be thrown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants