scott
scott

Reputation: 1070

HTML5 required attribute, javascript on required found but not entered?

Background info

I am trying to upgrade a custom CMS to support the HTML5 validation like required. When I have multiple languages for the same content, the form is put into tabs like (EN,ES,DE,etc). When a user clicks each tab they edit the contents of that language. (see image)

Problem

When a required field in ES is not filled in and the user currently has EN selected, nothing is highlighted since the ES is currently hidden. Can I catch the html5 built in validation and use jquery to change the tab or do I need to stick with the completely jquery based validation I had before (iterating through each input with required and checking $(this).val().length)

example image to show what I mean

Upvotes: 0

Views: 1014

Answers (1)

Smamatti
Smamatti

Reputation: 3931

This is the only solution I came up with: Displaying all languages.

$('#btn_submit').bind('click', function() {
    $('#content input:text[required]').parent('.lang_box').show();
});

Sample
http://jsfiddle.net/TkrVU/3/

Upvotes: 1

Related Questions