Giter VIP home page Giter VIP logo

form-validation's People

Contributors

bboyle avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

stevensimon

form-validation's Issues

event for invalid form submission

Should there be an event for invalid form submission?
Is there an event in the html5 spec? (XForms has one?)
An event to show when the summary is displayed (or its contents change)

Might be required to resize a layout.

inline .alert does not appear onsubmit

Inline alert is not appearing for a set of required radio buttons (but is for others).

may be related to find( '.label, .required' ), as .required is not always present in markup.
consider using abbr[title="(required)"] instead.

            $this.forcesForms( 'label' ).parent().find( '.label, abbr[title="(required)"]' ).eq( -1 ).after( alertElement );

add extra tests for radio buttons and try to reproduce.

move inline alert to group level

groups should display a single alert at the group level, rather than alerts for individual controls

this matches the submit summary

consider precedence if different errors existed in the group
the most likely scenario is multiple required fields being blank
however it's possible that some fields could have a custom error or pattern mismatch etc.

`.invalid` class not toggled correctly in atomic groups

Improve handling of .invalid class for atomic groups.

After submit, .invalid is applied to invalid questions and groups within a form.

If an atomic group is valid at submit, the group is not classed as .invalid (this is correct)
If an invalid entry is made within the group, the question is classed as .invalid (this is correct)
If an invalid entry is made within the group, the group is not classed as .invalid (this is INCORRECT)

If an atomic group is valid at submit, the group is classed as .invalid (this is correct)
If an invalid entry is corrected, the question is no longer classed as .invalid (this is correct)
If all invalid entries are corrected, the group is no longer classed as .invalid (this is correct)
If an invalid entry is corrected, but invalid questions remain, the group is no longer classed as .invalid (this is INCORRECT)

Atomic group alerts removed prematurely

If an atomic group contains multiple invalid fields, it will display a single alert message.

If one of those fields is corrected, the alert message is removed.
The alert message should be present (it may need to be updated) until all questions within the atomic group are valid.

reuse .status if available

A server-side script may insert .status block into the page.

If so, this should be reused instead of adding another .status block for the form error summary.

Atomic group validation failing in address block

Consider this grouping of form fields

Postal address (atomic group)

  • Address line 1
  • Address line 2
  • Compact group:
    • Suburb
    • State
    • Postcode

The inline 'must be completed` message should only appear for postal address. It is appearing for the suburb and postcode fields as well.

support for confirmation field

Example: confirm password, confirm email

Use custom validation. Value must exactly match value of previous field.
Note that the only validity constraint should be the 'confirmation' check.
e.g. If field A is type="email", the confirmation field B should be type="text" and not email.

If the confirmation field is not @required then it may be blank and will be valid.

Confirmation validation should be applied when both fields A and B have values. If only one field has a value, no validation is performed. This is to prevent users from being informed of errors (e.g. passwords do not match) before they even have a chance to type their input!

Blank fields will be handled by required validation, not confirmation validation.

Repeated required alert on radio button

  1. Create a form with a radio button group that is required and no item is selected by default
  2. Submit the form. One 'must be completed' alert should be shown
  3. Submit again. Only one 'must be completed' alert should be shown.

Sometimes multiple errors are appearing. May be an old version of the script and already be fixed.

Test coverage?

Select flashing bug

Clicking on a select list to open it causes options to flash quickly.

Observed in Ubuntu chrome and opera

required radio buttons

Strange behaviour for required radio buttons (when left blank).

  • may show multiple .alert inline warnings
  • may not remove inline warnings when a button is checked and or form submitted (after checking a radio button)

Do required checkboxes work?

Create a set of checkboxes and make them required.

Is the validation performed?
Does validation still work for other form fields?

Crash when field set missing

  1. Test a set of required radio buttons
  2. Leave out the 'fieldset' element
  3. Trigger validation to cause script error

provide a way to update UI for a specific question

For example: a required field may be display as invalid. The underlying @required might be toggled to make the field valid. There needs to be a way to update the UI to reflect this.

Consider:

$( '.invalid input' ).each(function() {
   this.removeAttribute('required');
}).forcesForms( 'checkValidity' );

where forcesForms( 'checkValidity' ) calls the .checkValidity() on the underlying DOM elements, and then updates the UI.

Validation failing with this markup pattern

                <li>
                    <label for="consultationResponse:group:0:question:3:answerTL:value">
                        <small class="instructions relevance">Please answer this question if you answered ‘<samp>No</samp>’ to ‘<var>Q1 Do you own a pet?</var></small>
                        <span class="label">Q3 Why don't you own a pet?</span>
                        <abbr title="(required)">*</abbr>
                    </label>
                    <textarea id="consultationResponse:group:0:question:3:answerTL:value" name="consultationResponse:group:0:question:3:answerTL:value" cols="100" rows="5" required="required"></textarea>
                    <small class="hint">Maximum 500 characters</small>
                </li>

Is the problem with the @id values? Are they being quoted in the [for="<id>"] filters?

Repeated calls to 'validate' bind multiple handlers

Calling .forcesForms( 'validate' ) binds submit event handlers.

Calling this repeatedly binds handlers again without first unbinding (or checking if already bound) which causes issues with submit suppression in the submit done handler.

Note that call validate once immediately and a second time 'ondocumentready' might be a problem if the second call unbinds ands rebinds—it may be bound AFTER other dependent handlers that were relying on submit being stopped if invalid fields were present.

Alert shown on valid radio buttons

Create a required set of radio buttons.
Submit form.
Radio group should be marked invalid.
Check one option.
Inline alert should be removed.
Submit.
Inline alert reappears.
(note summary is correct)

Group invalid highlight

When 2 (or more) items are invalid in a group, fixing one should not remove the invalid class from the group.

handle HTML issues gracefully

The script relies on specific HTML structures and classnames. When these don't exist, a script error can cause all validation checks to be skipped.

Example: if the script cannot locate the .label associated with an invalid element.

To reproduce, change class="label" to class="lable"

Possible fix: when .label cannot be found (0 elements) use @name or .generateId() fallbacks.

improve support for nested groups

Consider typical address pattern:

.atomic.group Residential address:

  • Street address (multiple lines)
  • .group:
    • Suburb
    • State
    • Postcode
  • Country

Allow 'locality' group (Suburb, State and Postcode) to use .group class, but display errors on 'Residential address' level.

Need to rework group, label and alert traversal.

Improve message format when invalid constraint involves multiple fields

We currently display this:

  • Your name: Must be completed
  • Your email: Must be an email addresses
  • Birth certificate: Your attachments are too large
  • Driver licence: Your attachments are too large

When we need something more like this:

  • Your name: Must be completed
  • Your email: Must be an email addresses
  • Your attachments are too large: birth certificate, driver licence

Maybe it should say:

  • Your attachments are too large (help)
  • And help pops up a lightbox to display the file sizes and offer help?

Undefined custom message

Use console to setCustomValidity
Submit

Error message should be shown
Summary and alert are saying 'undefined'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.