Give microapp form elements unique ids

This commit is contained in:
Zach Copley 2011-04-17 16:32:52 -07:00
parent 5f81f4c701
commit d9cf0280d2
11 changed files with 68 additions and 49 deletions

View File

@ -181,7 +181,7 @@ class BookmarkForm extends Form
function formActions() function formActions()
{ {
// TRANS: Button text for action to save a new bookmark. // TRANS: Button text for action to save a new bookmark.
$this->out->submit('submit', _m('BUTTON', 'Save')); $this->out->submit('bookmark-submit', _m('BUTTON', 'Save'), 'submit', 'submit');
} }
function scaleImage($width, $height) function scaleImage($width, $height)

View File

@ -88,6 +88,6 @@ class InitialBookmarkForm extends Form
function formActions() function formActions()
{ {
// TRANS: Button text for action to save a new bookmark. // TRANS: Button text for action to save a new bookmark.
$this->out->submit('submit', _m('BUTTON', 'Add')); $this->out->submit('initial-bookmark-submit', _m('BUTTON', 'Add'), 'submit', 'submit');
} }
} }

View File

@ -93,7 +93,7 @@ class CancelRSVPForm extends Form
{ {
$this->out->elementStart('fieldset', array('id' => 'new_rsvp_data')); $this->out->elementStart('fieldset', array('id' => 'new_rsvp_data'));
$this->out->hidden('rsvp', $this->rsvp->id); $this->out->hidden('rsvp-id', $this->rsvp->id, 'rsvp');
switch (RSVP::verbFor($this->rsvp->response)) { switch (RSVP::verbFor($this->rsvp->response)) {
case RSVP::POSITIVE: case RSVP::POSITIVE:
@ -121,6 +121,6 @@ class CancelRSVPForm extends Form
function formActions() function formActions()
{ {
// TRANS: Button text to cancel responding to an RSVP ("please respond") item. // TRANS: Button text to cancel responding to an RSVP ("please respond") item.
$this->out->submit('cancel', _m('BUTTON', 'Cancel')); $this->out->submit('rsvp-cancel', _m('BUTTON', 'Cancel'));
} }
} }

View File

@ -87,75 +87,83 @@ class EventForm extends Form
$this->out->elementStart('ul', 'form_data'); $this->out->elementStart('ul', 'form_data');
$this->li(); $this->li();
$this->out->input('title', $this->out->input('event-title',
// TRANS: Field label on event form. // TRANS: Field label on event form.
_m('LABEL','Title'), _m('LABEL','Title'),
null, null,
// TRANS: Field title on event form. // TRANS: Field title on event form.
_m('Title of the event.')); _m('Title of the event.'),
'title');
$this->unli(); $this->unli();
$this->li(); $this->li();
$this->out->input('startdate', $this->out->input('event-startdate',
// TRANS: Field label on event form. // TRANS: Field label on event form.
_m('LABEL','Start date'), _m('LABEL','Start date'),
null, null,
// TRANS: Field title on event form. // TRANS: Field title on event form.
_m('Date the event starts.')); _m('Date the event starts.'),
'startdate');
$this->unli(); $this->unli();
$this->li(); $this->li();
$this->out->input('starttime', $this->out->input('event-starttime',
// TRANS: Field label on event form. // TRANS: Field label on event form.
_m('LABEL','Start time'), _m('LABEL','Start time'),
null, null,
// TRANS: Field title on event form. // TRANS: Field title on event form.
_m('Time the event starts.')); _m('Time the event starts.'),
'starttime');
$this->unli(); $this->unli();
$this->li(); $this->li();
$this->out->input('enddate', $this->out->input('event-enddate',
// TRANS: Field label on event form. // TRANS: Field label on event form.
_m('LABEL','End date'), _m('LABEL','End date'),
null, null,
// TRANS: Field title on event form. // TRANS: Field title on event form.
_m('Date the event ends.')); _m('Date the event ends.'),
'enddate');
$this->unli(); $this->unli();
$this->li(); $this->li();
$this->out->input('endtime', $this->out->input('event-endtime',
// TRANS: Field label on event form. // TRANS: Field label on event form.
_m('LABEL','End time'), _m('LABEL','End time'),
null, null,
// TRANS: Field title on event form. // TRANS: Field title on event form.
_m('Time the event ends.')); _m('Time the event ends.'),
'endtime');
$this->unli(); $this->unli();
$this->li(); $this->li();
$this->out->input('location', $this->out->input('event-location',
// TRANS: Field label on event form. // TRANS: Field label on event form.
_m('LABEL','Location'), _m('LABEL','Location'),
null, null,
// TRANS: Field title on event form. // TRANS: Field title on event form.
_m('Event location.')); _m('Event location.'),
'location');
$this->unli(); $this->unli();
$this->li(); $this->li();
$this->out->input('url', $this->out->input('event-url',
// TRANS: Field label on event form. // TRANS: Field label on event form.
_m('LABEL','URL'), _m('LABEL','URL'),
null, null,
// TRANS: Field title on event form. // TRANS: Field title on event form.
_m('URL for more information.')); _m('URL for more information.'),
'url');
$this->unli(); $this->unli();
$this->li(); $this->li();
$this->out->input('description', $this->out->input('event-description',
// TRANS: Field label on event form. // TRANS: Field label on event form.
_m('LABEL','Description'), _m('LABEL','Description'),
null, null,
// TRANS: Field title on event form. // TRANS: Field title on event form.
_m('Description of the event.')); _m('Description of the event.'),
'description');
$this->unli(); $this->unli();
$this->out->elementEnd('ul'); $this->out->elementEnd('ul');
@ -176,6 +184,6 @@ class EventForm extends Form
function formActions() function formActions()
{ {
// TRANS: Button text to save an event.. // TRANS: Button text to save an event..
$this->out->submit('submit', _m('BUTTON', 'Save')); $this->out->submit('event-submit', _m('BUTTON', 'Save'), 'submit', 'submit');
} }
} }

View File

@ -96,7 +96,7 @@ class RSVPForm extends Form
// TRANS: Field label on form to RSVP ("please respond") for an event. // TRANS: Field label on form to RSVP ("please respond") for an event.
$this->out->text(_m('RSVP:')); $this->out->text(_m('RSVP:'));
$this->out->hidden('event', $this->event->id); $this->out->hidden('event-id', $this->event->id, 'event');
$this->out->hidden('submitvalue', ''); $this->out->hidden('submitvalue', '');
$this->out->elementEnd('fieldset'); $this->out->elementEnd('fieldset');
@ -119,12 +119,17 @@ class RSVPForm extends Form
function submitButton($id, $label) function submitButton($id, $label)
{ {
$this->out->element('input', array('type' => 'submit', $this->out->element(
'id' => $id, 'input',
'name' => $id, array(
'class' => 'submit', 'type' => 'submit',
'value' => $label, 'id' => 'rsvp-submit',
'title' => $label, 'name' => $id,
'onClick' => 'this.form.submitvalue.value = this.name; return true;')); 'class' => 'submit',
'value' => $label,
'title' => $label,
'onClick' => 'this.form.submitvalue.value = this.name; return true;'
)
);
} }
} }

View File

@ -122,11 +122,13 @@ class NewpollForm extends Form
$default = ''; $default = '';
} }
$this->li(); $this->li();
$this->out->input('option' . ($i + 1), $this->out->input('poll-option' . ($i + 1),
// TRANS: Field label for an answer option on the page to create a poll. // TRANS: Field label for an answer option on the page to create a poll.
// TRANS: %d is the option number. // TRANS: %d is the option number.
sprintf(_m('Option %d'), $i + 1), sprintf(_m('Option %d'), $i + 1),
$default); $default,
null,
'option' . ($i + 1));
$this->unli(); $this->unli();
} }
@ -148,6 +150,6 @@ class NewpollForm extends Form
function formActions() function formActions()
{ {
// TRANS: Button text for saving a new poll. // TRANS: Button text for saving a new poll.
$this->out->submit('submit', _m('BUTTON', 'Save')); $this->out->submit('poll-submit', _m('BUTTON', 'Save'), 'submit', 'submit');
} }
} }

View File

@ -124,6 +124,6 @@ class PollResponseForm extends Form
function formActions() function formActions()
{ {
// TRANS: Button text for submitting a poll response. // TRANS: Button text for submitting a poll response.
$this->out->submit('submit', _m('BUTTON', 'Submit')); $this->out->submit('poll-response-submit', _m('BUTTON', 'Submit'), 'submit', 'submit');
} }
} }

View File

@ -109,8 +109,8 @@ class QnanewanswerForm extends Form
$out->raw($this->question->asHTML()); $out->raw($this->question->asHTML());
} }
$out->hidden('id', $id); $out->hidden('qna-question-id', $id, 'id');
$out->textarea('answer', 'answer'); $out->textarea('qna-answer', 'answer', null, null, 'answer');
} }
/** /**
@ -121,7 +121,7 @@ class QnanewanswerForm extends Form
function formActions() function formActions()
{ {
// TRANS: Button text for submitting a poll response. // TRANS: Button text for submitting a poll response.
$this->out->submit('submit', _m('BUTTON', 'Answer')); $this->out->submit('qna-answer-submit', _m('BUTTON', 'Answer'), 'submit', 'submit');
} }
} }

View File

@ -105,18 +105,20 @@ class QnanewquestionForm extends Form
$this->li(); $this->li();
$this->out->input( $this->out->input(
'title', 'qna-question-title',
_m('Title'), _m('Title'),
$this->title, $this->title,
_m('Title of your question') _m('Title of your question'),
'title'
); );
$this->unli(); $this->unli();
$this->li(); $this->li();
$this->out->textarea( $this->out->textarea(
'description', 'qna-question-description',
_m('Description'), _m('Description'),
$this->description, $this->description,
_m('Your question in detail') _m('Your question in detail'),
'description'
); );
$this->unli(); $this->unli();
@ -138,6 +140,6 @@ class QnanewquestionForm extends Form
function formActions() function formActions()
{ {
// TRANS: Button text for saving a new question. // TRANS: Button text for saving a new question.
$this->out->submit('submit', _m('BUTTON', 'Save')); $this->out->submit('qna-question-submit', _m('BUTTON', 'Save'), 'submit', 'submit');
} }
} }

View File

@ -121,8 +121,9 @@ class QnashowanswerForm extends Form
function formData() function formData()
{ {
$this->out->hidden( $this->out->hidden(
'id', 'qna-answer-id',
'answer-' . $this->answer->id 'answer-' . $this->answer->id,
'id'
); );
$this->out->raw($this->answer->asHTML()); $this->out->raw($this->answer->asHTML());
@ -144,11 +145,11 @@ class QnashowanswerForm extends Form
if ($user->id == $this->question->profile_id) { if ($user->id == $this->question->profile_id) {
if (empty($this->answer->best)) { if (empty($this->answer->best)) {
$this->out->submit( $this->out->submit(
'best', 'qna-best-answer',
// TRANS: Button text for marking an answer as "best" // TRANS: Button text for marking an answer as "best"
_m('BUTTON', 'Best'), _m('BUTTON', 'Best'),
'submit', 'submit',
null, 'submit',
// TRANS: Title for button text marking an answer as "best" // TRANS: Title for button text marking an answer as "best"
_('Mark as best answer') _('Mark as best answer')
); );

View File

@ -114,8 +114,9 @@ class QnashowquestionForm extends Form
function formData() function formData()
{ {
$this->out->hidden( $this->out->hidden(
'id', 'qna-quesiton-id',
'question-' . $this->question->id 'question-' . $this->question->id,
'id'
); );
$this->out->raw($this->question->asHTML()); $this->out->raw($this->question->asHTML());
@ -136,11 +137,11 @@ class QnashowquestionForm extends Form
if (empty($this->question->closed)) { if (empty($this->question->closed)) {
if ($user->id == $this->question->profile_id) { if ($user->id == $this->question->profile_id) {
$this->out->submit( $this->out->submit(
'close', 'qna-question-close',
// TRANS: Button text for closing a question // TRANS: Button text for closing a question
_m('BUTTON', 'Close'), _m('BUTTON', 'Close'),
'submit', 'submit',
null, 'submit',
// TRANS: Title for button text for closing a question // TRANS: Title for button text for closing a question
_('Close the question') _('Close the question')
); );