Archivi categoria: form

i Form o “moduli / questionari” in italiano?

Ma come si traduce? mah..

Comunque belli i nuovi input che prendono i form nell’html5..

peccato che non funzioanino proprio ovunque..

HTML5 New Input Types

sarebbero questi, i diversi tipi ti input che gli potete dare:

  • color
  • date
  • datetime
  • datetime-local
  • email
  • month
  • number
  • range
  • search
  • tel
  • time
  • url
  • week

Io sto provando NUMBER, che diciamo dovrebbe essere quello più scontato e facilino, ma purtoppo il mio browser firefox 24 non me lo sta proprio calcolando, Safari 6 e Chrome 32 invece sì, nel senso che fanno scrivere solo numeri e non lettere e che ti visualizzano due bottoncini per aggiungere e togliere unità, ma non prendono in considerazione i valori di max e min che gli ho dato..

<< Use the following attributes to specify restrictions:

  • max – specifies the maximum value allowed
  • min – specifies the minimum value allowed
  • step – specifies the legal number intervals
  • value – Specifies the default value >>

dai.. magari la prossima settimana.. hahaha :P

Ah.. vi interessano gli attributi? tiè:

Attribute Purpose Notes
autofocus Focuses the input on the element when the page is loaded. autofocus can be applied to input, select, textarea, and button.
placeholder Gives the user a hint about what sort of data they should enter. The placeholder value is displayed in light text until the element gets focus and the user enters some data. It can be specified on input and textarea.
form Specifies one or more forms to which the input element belongs. By using the form attribute, the input elements can be placed anywhere on the page, not just within the form element. Also, a single input element can be associated with more than one form.
required A boolean attribute that means the element is required. The required attribute is helpful for doing browser-based validation without using custom JavaScript.
autocomplete For specifying that a field should not autocomplete or be pre-filled by the browser based on a user’s past entries. The autocomplete attribute for fields like a credit card number or one-time password, which you don’t want autocomplete. By default, autocomplete is in the on state, so if you want to disable it, set it to off.
pattern For validating an element’s value against a regular expression. When using a pattern, you should also specify a title value to give the user a description of the pattern that’s expected.
dirname For submitting the directionality of the control with the form. For example, if the user entered text data with right-to-left directionality and the input element contained the dirname attribute, then an indication of the right-to-left directionality would be submitted along with the input value.
novalidate For disabling form submission validation when specified on a form element.
formaction For overriding the action attribute on the form element. This attribute is supported on input and button elements.
formenctype For overriding the enctype attribute on the form element. This attribute is supported on input and button elements.
formmethod For overriding the method attribute on the form element. This attribute is supported on input and button elements.
formnovalidate For overriding the novalidate attribute on the form element. This attribute is supported on input and button elements.
formtarget For overriding the target attribute on the form element. This attribute is supported on input and button elements.

provenienti da qua: http://www.html5rocks.com/en/tutorials/forms/html5forms/

Dai, tanto che ci siamo spolveriamo anche le diverse tipologie,

ovvero, potete avere :

– campo di testo: text

– spunta tonda: radio

– spunta quadrata: checkbox

La sintassi del tutto verrà così.. non molto diversa da quello che si è abituati:
<div>A  testo n. <input type=”number” size=”1″ name=”quiz1″  min=”1″ max=”6″ id=”A”  >
<div>B testo n. <input type=”number” size=”1″ name=”quiz1″  min=”1″ max=”6″ id=”B”  >
<div>C testo n. <input type=”number” size=”1″ name=”quiz1″  min=”1″ max=”6″ id=”C” value=”1″ >

 

Poi potreste avere il dilemma:

ma posso spuntare solo una, due, tre scelte, o tutte,… posso settare questa cosa?

bhe, W3Schools dice così..   ma a me risulta NON funzioni sempre…  http://www.w3schools.com/html/html5_form_input_types.asp

Radio Buttons

<input type=”radio”> defines a radio button. Radio buttons let a user select ONLY ONE of a limited number of choices:

<form>
<input type=”radio” name=”sex” value=”male”>Male<br>
<input type=”radio” name=”sex” value=”female”>Female
</form>

How the HTML code above looks in a browser:

Male
Female

Checkboxes

<input type=”checkbox”> defines a checkbox. Checkboxes let a user select ZERO or MORE options of a limited number of choices.

<form>
<input type=”checkbox” name=”vehicle” value=”Bike”>I have a bike<br>
<input type=”checkbox” name=”vehicle” value=”Car”>I have a car
</form>

How the HTML code above looks in a browser:

I have a bike
I have a car—-