コード例 #1
0
 function renderElement()
 {
     $address = $this->getValue();
     if (!is_array($address)) {
         $address = array();
     }
     if (!array_key_exists('address1', $address)) {
         $address['address1'] = null;
     }
     if (!array_key_exists('address2', $address)) {
         $address['address2'] = null;
     }
     if (!array_key_exists('postcode', $address)) {
         $address['postcode'] = null;
     }
     if (!array_key_exists('town', $address)) {
         $address['town'] = null;
     }
     /*
      * The rendering of this element is SO messy due to IE compatibility - needs rewriting
      *
      */
     $out = sf("<div style='float:left;'><input type='text' name='%s[address1]' value='%s' %s id='form_%s' class='inputUkAddress inputUkAddress1' /><br />", $this->getName(), parent::makeInputSafe($address['address1']), $this->tabindex ? sf('tabindex="%s"', $this->tabindex) : '', $this->getName());
     $out .= sf("<input type='text' name='%s[address2]' value='%s' %s id='form_%s' class='text' class='inputUkAddress inputUkAddress2' /><br />", $this->getName(), parent::makeInputSafe($address['address2']), $this->tabindex ? sf('tabindex="%s"', $this->tabindex) : '', $this->getName());
     $out .= sf("</div><div style='clear:both;'><label for='form_%s'>%s</label>", $this->getName(), "Post Code");
     $out .= sfl("<table style='border:0px; border-spacing:0px;.' cellpadding=0 cellspacing=0><tr><td style=''><input type='text' name='%s[postcode]' value='%s' %s id='form_%s' class='postCode'  class='inputUkAddress inputUkAddressPostCode'  />", $this->getName(), parent::makeInputSafe($address['postcode']), $this->tabindex ? sf('tabindex="%s"', $this->tabindex) : '', $this->getName());
     $out .= sfl("</td><td class='tRight'><label class='town'>Town</label></td><td><input type='text' name='%s[town]' value='%s' %s id='form_%s' class='town'  class='inputUkAddress inputUkAddressTown' /></td></tr></table></div>", $this->getName(), parent::makeInputSafe($address['town']), $this->tabindex ? sf('tabindex="%s"', $this->tabindex) : '', $this->getName());
     return $out;
 }
コード例 #2
0
 function renderElement()
 {
     $name = $this->getValue();
     if (!is_array($name)) {
         $name = array();
     }
     if (!array_key_exists('title', $name)) {
         $name['title'] = null;
     }
     if (!array_key_exists('firstName', $name)) {
         $name['firstName'] = null;
     }
     if (!array_key_exists('lastName', $name)) {
         $name['lastName'] = null;
     }
     $titleOptions = sfl("<option value='' >Title</option>");
     foreach ($this->titles as $title => $data) {
         if ($name['title'] == $title) {
             $titleOptions .= sfl("<option value='%s' selected='selected'>%s</option>", parent::makeInputSafe($title), $data['text']);
         } else {
             $titleOptions .= sfl("<option value='%s'>%s</option>", parent::makeInputSafe($title), $data['text']);
         }
     }
     $out = sfl("<select name='%s[title]' %s id='form_%s' class='inputName inputNameTitle' >%s</select>", $this->getName(), $this->tabindex ? sf('tabindex="%s"', $this->tabindex) : '', $this->getName(), $titleOptions);
     $out .= sfl("<input type='text' name='%s[firstName]' value='%s' %s id='form_%s' class='inputName inputNameFirst' class='text' />", $this->getName(), parent::makeInputSafe($name['firstName']), $this->tabindex ? sf('tabindex="%s"', $this->tabindex) : '', $this->getName());
     $out .= sfl("<input type='text' name='%s[lastName]' value='%s' %s id='form_%s' class='inputName inputNameLast' class='text' />", $this->getName(), parent::makeInputSafe($name['lastName']), $this->tabindex ? sf('tabindex="%s"', $this->tabindex) : '', $this->getName());
     return $out;
 }
コード例 #3
0
 function renderElement()
 {
     $attributesHtml = '';
     if (count($this->attributes)) {
         foreach ($this->attributes as $key => $val) {
             $attributesHtml .= sf(' %s="%s" ', $key, $val);
         }
     }
     return sf('<input type="%s" name="%s" value="%s" %s id="form_%s" class="%s" %s%s%s%s%s%s%s />', $this->htmlType, $this->getName(), parent::makeInputSafe($this->getValue()), $this->tabindex ? sf('tabindex="%s"', $this->tabindex) : '', $this->getName(), $this->cssClassName, $attributesHtml, strlen($this->placeholder) ? sf(' placeholder="%s"', $this->placeholder) : '', !is_null($this->onChange) && strlen($this->onChange) ? sf(' onChange="%s"', $this->onChange) : '', !is_null($this->onKeydown) && strlen($this->onKeydown) ? sf(' onKeydown="%s"', $this->onKeydown) : '', !is_null($this->onFocus) && strlen($this->onFocus) ? sf(' onFocus="%s"', $this->onFocus) : '', !is_null($this->onBlur) && strlen($this->onBlur) ? sf(' onBlur="%s"', $this->onBlur) : '', $this->disabled ? ' disabled' : '');
 }
コード例 #4
0
 function renderElement()
 {
     $attributesHtml = '';
     if (count($this->attributes)) {
         foreach ($this->attributes as $key => $val) {
             $attributesHtml .= sf(' %s="%s" ', $key, $val);
         }
     }
     return sf("<input type='hidden' name='%s' value='%s' id='form_%s' class='inputHidden' %s />", $this->getName(), parent::makeInputSafe($this->getValue()), $this->getName(), $attributesHtml);
 }
コード例 #5
0
 function renderElement()
 {
     $html = "";
     $elementValue = $this->getValue();
     $usedSuggested = false;
     foreach ($this->options as $value => $option) {
         if (strval($elementValue) == strval($value)) {
             $usedSuggested = true;
             $html .= sfl('<div class="inputSuggestionOption"><input type="radio" name="%s" value="%s" %s checked="checked"  /> %s</div>', $this->getName(), parent::makeInputSafe($value), $this->tabindex ? sf('tabindex="%s"', $this->tabindex) : '', $option);
         } else {
             $html .= sfl('<div class="inputSuggestionOption"><input type="radio" name="%s" value="%s" %s /> %s</div>', $this->getName(), parent::makeInputSafe($value), $this->tabindex ? sf('tabindex="%s"', $this->tabindex) : '', $option);
         }
     }
     return sf("<div class='inputSuggestionContainer'>%s\n\t\t\t\t\t\t<div class='inputSuggestionOption'>%s %s<input type='text' name='%s' value='%s' class='inputSuggestionText' />%s</div></div>", $html, sfl('<input type="radio" name="%s" value="custom" %s %s />', $this->getName(), $this->tabindex ? sf('tabindex="%s"', $this->tabindex) : '', $usedSuggested ? "" : 'checked="checked"'), $this->beforeText, $this->getName() . "_custom", $usedSuggested ? "" : parent::makeInputSafe($this->getValue()), $this->afterText);
 }
コード例 #6
0
 function renderElement()
 {
     $value = $this->getValue();
     if (!is_array($value)) {
         $value = array();
     }
     if (!array_key_exists(0, $value)) {
         $value[0] = "";
     }
     if (!array_key_exists(1, $value)) {
         $value[1] = "";
     }
     $out = sf("<input type='%s' name='%s[0]' value='%s' %s id='form_%s' class='%s %sPrimary' %s /><br />", $this->htmlType, $this->getName(), parent::makeInputSafe($value[0]), $this->tabindex ? sf('tabindex="%s"', $this->tabindex) : '', $this->getName(), $this->cssClassName, $this->cssClassName, strlen($this->placeholder) ? sf(' placeholder="%s"', $this->placeholder) : '');
     $out .= sf("<label for='form_%s' class='rowLabel f08 rowLabelSecondary'>%s%s</label>", $this->getName(), $this->confirmText, $this->getRequired() && !$this->getValidates() ? $this->goAsterisks() : "");
     $out .= sf("<input type='%s' name='%s[1]' value='%s' %s id='form_%s' class='%s %sSecondary' />", $this->htmlType, $this->getName(), parent::makeInputSafe($value[1]), $this->tabindex ? sf('tabindex="%s"', $this->tabindex) : '', $this->getName(), $this->cssClassName, $this->cssClassName);
     return $out;
 }