HTML5 required attribute for some input forms

This commit is contained in:
Mikael Nordfeldth
2014-04-06 11:27:41 +02:00
parent 0777aa5487
commit a2a2105058
8 changed files with 29 additions and 12 deletions

View File

@@ -121,7 +121,8 @@ class BookmarkForm extends Form
_m('LABEL','URL'),
$this->_url,
null,
'url');
'url',
true); // HTML5 "required" attribute
$this->unli();
if (!empty($this->_thumbnail)) {
@@ -142,7 +143,8 @@ class BookmarkForm extends Form
_m('LABEL','Title'),
$this->_title,
null,
'title');
'title',
true); // HTML5 "required" attribute
$this->unli();
$this->li();

View File

@@ -78,7 +78,8 @@ class InitialBookmarkForm extends Form
_m('LABEL','URL'),
null,
null,
'url');
'url',
true); // HTML5 "required" attribute
$this->unli();
$this->out->elementEnd('ul');

View File

@@ -104,7 +104,8 @@ class EventForm extends Form
null,
// TRANS: Field title on event form.
_m('Title of the event.'),
'title');
'title',
true); // HTML5 "required" attribute
$this->unli();
$this->li();
@@ -195,7 +196,8 @@ class EventForm extends Form
null,
// TRANS: Field title on event form.
_m('Description of the event.'),
'description');
'description',
true); // HTML5 "required" attribute
$this->unli();
$this->out->elementEnd('ul');

View File

@@ -107,7 +107,9 @@ class NewpollForm extends Form
_m('Question'),
$this->question,
// TRANS: Field title on the page to create a poll.
_m('What question are people answering?'));
_m('What question are people answering?'),
'question',
true); // HTML5 "required" attribute
$this->unli();
$max = 5;
@@ -128,7 +130,8 @@ class NewpollForm extends Form
sprintf(_m('Option %d'), $i + 1),
$default,
null,
'option' . ($i + 1));
'option' . ($i + 1),
$i<2); // HTML5 "required" attribute for 2 options
$this->unli();
}

View File

@@ -111,7 +111,7 @@ class QnanewanswerForm extends Form
$out->hidden('qna-question-id', $id, 'id');
// TRANS: Field label.
$out->textarea('qna-answer', _m('Enter your answer'), null, null, 'answer');
$out->textarea('qna-answer', _m('Enter your answer'), null, null, 'answer', true);
}
/**

View File

@@ -111,7 +111,8 @@ class QnanewquestionForm extends Form
$this->title,
// TRANS: Field title for a new question.
_m('The title of your question.'),
'title'
'title',
true // HTML5 "required" attribute
);
$this->unli();
$this->li();
@@ -122,7 +123,8 @@ class QnanewquestionForm extends Form
$this->description,
// TRANS: Field title for question details.
_m('Your question in detail.'),
'description'
'description',
true // HTML5 "required" attribute
);
$this->unli();