Skip to content

Commit

Permalink
Merge pull request #13526 from yashodha/number_widget
Browse files Browse the repository at this point in the history
use number widget for weight and other numeric fields in more forms
  • Loading branch information
eileenmcnaughton authored Feb 4, 2019
2 parents 631a62f + d70ada2 commit c038b19
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CRM/Admin/Form/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public function buildQuickForm() {
);
}

$this->add('text',
$this->add('number',
'weight',
ts('Order'),
CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'weight'),
Expand Down
2 changes: 1 addition & 1 deletion CRM/Event/Form/ManageEvent/EventInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public function buildQuickForm() {
$this->add('datepicker', 'start_date', ts('Start'), [], !$this->_isTemplate, ['time' => TRUE]);
$this->add('datepicker', 'end_date', ts('End'), [], FALSE, ['time' => TRUE]);

$this->add('text', 'max_participants', ts('Max Number of Participants'),
$this->add('number', 'max_participants', ts('Max Number of Participants'),
array('onchange' => "if (this.value != '') {cj('#id-waitlist').show(); showHideByValue('has_waitlist','0','id-waitlist-text','table-row','radio',false); showHideByValue('has_waitlist','0','id-event_full','table-row','radio',true); return;} else {cj('#id-event_full, #id-waitlist, #id-waitlist-text').hide(); return;}")
);
$this->addRule('max_participants', ts('Max participants should be a positive number'), 'positiveInteger');
Expand Down
2 changes: 1 addition & 1 deletion CRM/Member/Form/Membership.php
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ public function buildQuickForm() {
}

if ($this->_action & CRM_Core_Action::ADD) {
$this->add('text', 'num_terms', ts('Number of Terms'), array('size' => 6));
$this->add('number', 'num_terms', ts('Number of Terms'), array('size' => 6));
}

$this->add('text', 'source', ts('Source'),
Expand Down
2 changes: 1 addition & 1 deletion CRM/Member/Form/MembershipRenewal.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ public function buildQuickForm() {
array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::financialType()
);

$this->add('text', 'num_terms', ts('Extend Membership by'), array('onchange' => "setPaymentBlock();"), TRUE);
$this->add('number', 'num_terms', ts('Extend Membership by'), array('onchange' => "setPaymentBlock();"), TRUE);
$this->addRule('num_terms', ts('Please enter a whole number for how many periods to renew.'), 'integer');

if (CRM_Core_Permission::access('CiviContribute') && !$this->_mode) {
Expand Down
2 changes: 1 addition & 1 deletion CRM/PCP/BAO/PCP.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ public static function buildPCPForm($form) {

$form->addElement('checkbox', 'is_tellfriend_enabled', ts("Allow 'Tell a friend' functionality"), NULL, array('onclick' => "return showHideByValue('is_tellfriend_enabled',true,'tflimit','table-row','radio',false);"));

$form->add('text',
$form->add('number',
'tellfriend_limit',
ts("'Tell a friend' maximum recipients limit"),
CRM_Core_DAO::getAttribute('CRM_PCP_DAO_PCPBlock', 'tellfriend_limit')
Expand Down
4 changes: 2 additions & 2 deletions CRM/Pledge/Form/Pledge.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public function buildQuickForm() {
);
$this->addRule('installments', ts('Please enter a valid number of installments.'), 'positiveInteger');

$frequencyInterval = $this->add('text', 'frequency_interval', ts('every'),
$frequencyInterval = $this->add('number', 'frequency_interval', ts('every'),
$attributes['pledge_frequency_interval'], TRUE
);
$this->addRule('frequency_interval', ts('Please enter a number for frequency (e.g. every "3" months).'), 'positiveInteger');
Expand All @@ -289,7 +289,7 @@ public function buildQuickForm() {
TRUE
);

$frequencyDay = $this->add('text', 'frequency_day', ts('Payments are due on the'), $attributes['frequency_day'], TRUE);
$frequencyDay = $this->add('number', 'frequency_day', ts('Payments are due on the'), $attributes['frequency_day'], TRUE);
$this->addRule('frequency_day', ts('Please enter a valid payment due day.'), 'positiveInteger');

$this->add('text', 'eachPaymentAmount', ts('each'), array(
Expand Down
6 changes: 3 additions & 3 deletions CRM/Price/Form/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,18 +176,18 @@ public function buildQuickForm() {
'' => ' ',
) + $membershipTypes, FALSE,
array('onClick' => "calculateRowValues( );"));
$this->add('text', 'membership_num_terms', ts('Number of Terms'), $attributes['membership_num_terms']);
$this->add('number', 'membership_num_terms', ts('Number of Terms'), $attributes['membership_num_terms']);
}
else {
$allComponents = explode(CRM_Core_DAO::VALUE_SEPARATOR, $extendComponentId);
$eventComponentId = CRM_Core_Component::getComponentID('CiviEvent');
if (in_array($eventComponentId, $allComponents)) {
$this->isEvent = TRUE;
// count
$this->add('text', 'count', ts('Participant Count'));
$this->add('number', 'count', ts('Participant Count'));
$this->addRule('count', ts('Please enter a valid Max Participants.'), 'positiveInteger');

$this->add('text', 'max_value', ts('Max Participants'));
$this->add('number', 'max_value', ts('Max Participants'));
$this->addRule('max_value', ts('Please enter a valid Max Participants.'), 'positiveInteger');
}

Expand Down

0 comments on commit c038b19

Please sign in to comment.