public function get_submitted_value() { $source = $this->get_value_source(); $values = array(); foreach ($source as $field_name => $field_value) { if (strpos($field_name, $this->get_name() . '_') === 0) { $num = str_replace($this->get_name() . '_', '', $field_name); // Нашли поле, отвечающее за имя if (preg_match('#^[0-9]+$#', $num)) { $namefield = new CM_Field_String(); $namefield->set_name($field_name); $namefield->set_value_source($this->get_value_source()); $name = $namefield->get_submitted_value()->get_raw(); $valuefield = clone $this->get_value_field(); $value = arr::get(array_values($this->get_value()->get_values()), $num); if ($value) { $value = $value->get_raw(); } $valuefield->set_raw_value($value); $valuefield->set_name($field_name . '_value'); $valuefield->set_value_source($this->get_value_source()); $values[$name] = $valuefield->get_submitted_value()->get_raw(); } } } return $this->create_raw_value(serialize($values)); }
protected function validate() { parent::validate(); if (!preg_match('#^[ 0-9\\+\\-\\(\\)]+$#', $this->get_value()->get_raw())) { $this->set_error('Телефон может содержать только цифры, скобки, пробелы, - и +'); } }
echo $name; ?> _next_field_num = <?php echo $i; ?> ; //--> </script> </td> </tr> <?php } ?> </tbody> <?php $field_name = new CM_Field_String(); $field_name->set_name($name . '___i__'); $value_field->set_name($name . '___i___value'); if ($allow_add) { ?> <tr style="display: none;" id="<?php echo $name; ?> _field_new"> <td> <?php echo $field_name->render(); ?> </td> <td> <?php
public function __construct() { parent::__construct(); }