本文整理匯總了PHP中NumericField::setAttribute方法的典型用法代碼示例。如果您正苦於以下問題:PHP NumericField::setAttribute方法的具體用法?PHP NumericField::setAttribute怎麽用?PHP NumericField::setAttribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類NumericField
的用法示例。
在下文中一共展示了NumericField::setAttribute方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getNumericField
/**
* @param string $name
* @param string $title
*
* @return NumericField
*/
protected function getNumericField($name, $title)
{
$field = new NumericField($name, $title);
$field->setAttribute("type", "number");
$field->setAttribute("min", 0);
return $field;
}
示例2: getQuantityField
/**
* @param String $label
* @return NumericField
*/
public function getQuantityField($label = '')
{
$f = new NumericField("Product[{$this->owner->ID}][Quantity]", $label);
$f->setAttribute('type', Config::inst()->get('GroupedCartFormChildHooks', 'quantity_field_type'));
$f->setAttribute('min', '0');
$f->addExtraClass('grouped-quantity');
return $f;
}
開發者ID:helpfulrobot,項目名稱:markguinn-silverstripe-shop-groupedproducts,代碼行數:12,代碼來源:GroupedCartFormChildHooks.php
示例3: getFormField
/**
* @return NumericField
*/
public function getFormField()
{
$field = new NumericField($this->Name, $this->Title);
$field->addExtraClass('number');
if ($field->Required) {
// Required and numeric validation can conflict so add the
// required validation messages as input attributes
$errorMessage = $this->getErrorMessage()->HTML();
$field->setAttribute('data-rule-required', 'true');
$field->setAttribute('data-msg-required', $errorMessage);
}
return $field;
}
示例4: getFormField
/**
* @return TextareaField|TextField
*/
public function getFormField()
{
if ($this->getSetting('Rows') && $this->getSetting('Rows') > 1) {
$taf = new NumericField($this->Name, $this->Title);
$taf->setRows($this->getSetting('Rows'));
$taf->addExtraClass('number');
} else {
$taf = new NumericField($this->Name, $this->Title, null, $this->getSetting('MaxLength'));
$taf->addExtraClass('number');
}
if ($this->Required) {
// Required and numeric validation can conflict so add the Required validation messages
// as input attributes
$errorMessage = $this->getErrorMessage()->HTML();
$taf->setAttribute('data-rule-required', 'true');
$taf->setAttribute('data-msg-required', $errorMessage);
}
return $taf;
}