Using the HTML5 “required” attribute for a group of checkboxes?

Unfortunately HTML5 does not provide an out-of-the-box way to do that. However, using jQuery, you can easily control if a checkbox group has at least one checked element. Consider the following DOM snippet: <div class=”checkbox-group required”> <input type=”checkbox” name=”checkbox_name[]”> <input type=”checkbox” name=”checkbox_name[]”> <input type=”checkbox” name=”checkbox_name[]”> <input type=”checkbox” name=”checkbox_name[]”> </div> You can use this expression: $(‘div.checkbox-group.required … Read more

Tool to generate JSON schema from JSON data [closed]

Summarising the other answers, here are the JSON schema generators proposed so far: Online: https://www.liquid-technologies.com/online-json-to-schema-converter (1 input) http://www.jsonschema.net (1 input) https://easy-json-schema.github.io (1 input) Python: https://github.com/gonvaled/jskemator (1 input but allows iteration) https://github.com/perenecabuto/json_schema_generator (1 input) https://github.com/rnd0101/json_schema_inferencer (1 input I think) https://pypi.python.org/pypi/genson/ (multiple inputs) https://pypi.python.org/pypi/skinfer (multiple inputs) NodeJS: https://github.com/Nijikokun/generate-schema (multiple inputs (pass object array)) https://github.com/easy-json-schema/easy-json-schema (1 input) https://github.com/aspecto-io/genson-js … Read more

How can I conditionally require form inputs with AngularJS?

There’s no need to write a custom directive. Angular’s documentation is good but not complete. In fact, there is a directive called ngRequired, that takes an Angular expression. <input type=”email” name=”email” ng-model=”contact.email” placeholder=”your@email.com” ng-required=’!contact.phone’ /> <input type=”text” ng-model=”contact.phone” placeholder=”(xxx) xxx-xxxx” ng-required=’!contact.email’ /> Here’s a more complete example: http://jsfiddle.net/uptnx/1/

jQuery: what is the best way to restrict “number”-only input for textboxes? (allow decimal points)

If you want to restrict input (as opposed to validation), you could work with the key events. something like this: <input type=”text” class=”numbersOnly” value=”” /> And: jQuery(‘.numbersOnly’).keyup(function () { this.value = this.value.replace(/[^0-9\.]/g,”); }); This immediately lets the user know that they can’t enter alpha characters, etc. rather than later during the validation phase. You’ll still … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)