Example #1
0
 function build()
 {
     $output = "";
     if (parent::build() === false) {
         return;
     }
     switch ($this->status) {
         case "disabled":
         case "show":
             if (!isset($this->value)) {
                 $output = $this->layout['null_label'];
             } else {
                 $output = $this->checked ? $this->checked_output : $this->unchecked_output;
             }
             break;
         case "create":
         case "modify":
             $output = Form::checkbox($this->name, $this->checked_value, $this->checked) . $this->extra_output;
             break;
         case "hidden":
             $output = Form::hidden($this->name, $this->value);
             break;
         default:
     }
     $this->output = $output;
 }
 public function build()
 {
     $output = "";
     if (parent::build() === false) {
         return;
     }
     switch ($this->status) {
         case "show":
             $output = $this->value;
             $output = "<div class='help-block' style='background-color:" . $output . "'>&nbsp;</div>";
             break;
         case "create":
         case "modify":
             Rapyd::css('colorpicker/css/bootstrap-colorpicker.min.css');
             Rapyd::js('colorpicker/js/bootstrap-colorpicker.min.js');
             $output = Form::text($this->name, $this->value, $this->attributes);
             $output .= Rapyd::script("\n                        \$('#" . $this->name . "').colorpicker({\n                            format: 'hex'\n                        });");
             break;
         case "hidden":
             $output = Form::hidden($this->name, $this->value);
             break;
         default:
     }
     $this->output = $output;
 }
Example #3
0
 public function build()
 {
     $output = "";
     unset($this->attributes['type'], $this->attributes['size']);
     if (parent::build() === false) {
         return;
     }
     switch ($this->status) {
         case "disabled":
         case "show":
             if (!isset($this->value)) {
                 $output = $this->layout['null_label'];
             } else {
                 $output = $this->description;
             }
             $output = "<div class='help-block'>" . $output . "&nbsp;</div>";
             break;
         case "create":
         case "modify":
             $output = Form::select($this->name, $this->options, $this->value, $this->attributes) . $this->extra_output;
             break;
         case "hidden":
             $output = Form::hidden($this->name, $this->value);
             break;
         default:
     }
     $this->output = $output;
 }
Example #4
0
 public function build()
 {
     $output = "";
     if (parent::build() === false) {
         return;
     }
     switch ($this->status) {
         case "disabled":
         case "show":
             if ($this->type == 'hidden' || $this->value == "") {
                 $output = "";
             } elseif (!isset($this->value)) {
                 $output = $this->layout['null_label'];
             } else {
                 $output = nl2br(htmlspecialchars($this->value));
             }
             $output = "<div class='help-block'>" . $output . "&nbsp;</div>";
             break;
         case "create":
         case "modify":
             Rapyd::js('redactor/jquery.browser.min.js');
             Rapyd::js('redactor/redactor.min.js');
             Rapyd::css('redactor/css/redactor.css');
             $output = Form::textarea($this->name, $this->value, $this->attributes);
             Rapyd::script("\$('#" . $this->name . "').redactor();");
             break;
         case "hidden":
             $output = Form::hidden($this->name, $this->value);
             break;
         default:
     }
     $this->output = "\n" . $output . "\n" . $this->extra_output . "\n";
 }
Example #5
0
 public function build()
 {
     $output = "";
     if (parent::build() === false) {
         return;
     }
     switch ($this->status) {
         case "disabled":
         case "show":
             if (!isset($this->value)) {
                 $output = $this->layout['null_label'];
             } else {
                 $output = $this->description;
             }
             $output = "<div class='help-block'>" . $output . "&nbsp;</div>";
             break;
         case "create":
         case "modify":
             foreach ($this->options as $val => $label) {
                 $this->checked = (!is_null($this->value) and $this->value == $val);
                 $output .= Form::radio($this->name, $val, $this->checked) . ' ' . $label . $this->separator;
             }
             $output .= $this->extra_output;
             break;
         case "hidden":
             $output = Form::hidden($this->name, $this->value);
             break;
         default:
     }
     $this->output = $output;
 }
Example #6
0
 public function build()
 {
     $output = "";
     if (parent::build() === false) {
         return;
     }
     switch ($this->status) {
         case "disabled":
         case "show":
             if ($this->type == 'hidden' || $this->value == "") {
                 $output = "";
             } elseif (!isset($this->value)) {
                 $output = $this->layout['null_label'];
             } else {
                 $output = nl2br(htmlspecialchars($this->value));
             }
             $output = "<div class='help-block'>" . $output . "&nbsp;</div>";
             break;
         case "create":
         case "modify":
             $output = Form::text($this->name, $this->value, array_merge(array('class' => 'col-xs-12'), $this->attributes));
             break;
         case "hidden":
             $output = Form::hidden($this->name, $this->value);
             break;
         default:
     }
     $this->output = "\n" . $output . "\n" . $this->extra_output . "\n";
 }
Example #7
0
 public function build()
 {
     $output = "";
     if (parent::build() === false) {
         return;
     }
     switch ($this->status) {
         case "disabled":
         case "show":
             if ($this->type == 'hidden' || $this->value == "") {
                 $output = "";
             } elseif (!isset($this->value)) {
                 $output = $this->layout['null_label'];
             } else {
                 $output = "********";
             }
             $output = "<div class='help-block'>" . $output . "&nbsp;</div>";
             break;
         case "create":
         case "modify":
             $output = Form::password($this->name, $this->attributes);
             break;
         case "hidden":
             $output = "";
             break;
         default:
     }
     $this->output = "\n" . $output . "\n" . $this->extra_output . "\n";
 }
Example #8
0
 public function build()
 {
     $output = "";
     if (parent::build() === false) {
         return;
     }
     switch ($this->status) {
         case "disabled":
         case "show":
             if ($this->type == 'hidden' || $this->value == "") {
                 $output = "";
             } elseif (!isset($this->value)) {
                 $output = $this->layout['null_label'];
             } else {
                 $output = nl2br(htmlspecialchars($this->value));
             }
             $output = "<div class='help-block'>" . $output . "&nbsp;</div>";
             break;
         case "create":
         case "modify":
             Rapyd::js('tinymce/tinymce.min.js');
             Rapyd::js('tinymce/tinymce_editor.js');
             $output = Form::textarea($this->name, $this->value, $this->attributes);
             Rapyd::script("function elFinderBrowser (field_name, url, type, win) {" . "tinymce.activeEditor.windowManager.open({" . "file: '" . route('elfinder.tinymce4') . "'," . "title: 'elFinder 2.0'," . "width: 900," . "height: 450," . "resizable: 'yes'" . "}, {" . "setUrl: function (url) {" . "win.document.getElementById(field_name).value = url;" . "}" . "});" . "return false;" . "}");
             Rapyd::script("tinymce.init({selector: '#" . $this->name . "', file_browser_callback : elFinderBrowser, plugins: 'image', convert_urls: false});");
             break;
         case "hidden":
             $output = Form::hidden($this->name, $this->value);
             break;
         default:
     }
     $this->output = "\n" . $output . "\n" . $this->extra_output . "\n";
 }
Example #9
0
 public function build()
 {
     $output = "";
     $this->attributes["class"] = "btn btn-default";
     if (parent::build() === false) {
         return;
     }
     switch ($this->status) {
         case "disabled":
         case "show":
             if ($this->type == 'hidden' || $this->value == "") {
                 $output = "";
             } elseif (!isset($this->value)) {
                 $output = $this->layout['null_label'];
             } else {
                 $output = nl2br(htmlspecialchars($this->value));
             }
             break;
         case "create":
         case "modify":
             $output = Form::submit($this->label, $this->attributes);
             break;
         default:
     }
     $this->output = "\n" . $output . "\n" . $this->extra_output . "\n";
 }
Example #10
0
 public function build()
 {
     $output = "";
     if (parent::build() === false) {
         return;
     }
     switch ($this->status) {
         case "disabled":
         case "show":
             if (!isset($this->value)) {
                 $output = $this->layout['null_label'];
             } else {
                 $output = $this->checked ? $this->checked_output : $this->unchecked_output;
             }
             $output = "<div class='help-block'>" . $output . "&nbsp;</div>";
             break;
         case "create":
         case "modify":
             //dd($this->checked);
             $output = Form::checkbox($this->name, $this->checked_value, $this->checked, $this->attributes) . $this->extra_output;
             break;
         case "hidden":
             $output = Form::hidden($this->name, $this->value);
             break;
         default:
     }
     $this->output = $output;
 }
Example #11
0
 public function build()
 {
     $output = "";
     $this->attributes["class"] = "form-control";
     if (parent::build() === false) {
         return;
     }
     switch ($this->status) {
         case "disabled":
         case "show":
             if ($this->type == 'hidden' || $this->value == "") {
                 $output = "";
             } elseif (!isset($this->value)) {
                 $output = $this->layout['null_label'];
             } else {
                 $output = nl2br(htmlspecialchars($this->value));
             }
             $output = "<div class='help-block'>" . $output . "</div>";
             break;
         case "create":
         case "modify":
             $output = Form::file($this->db_name, $this->attributes);
             break;
         case "hidden":
             $output = Form::hidden($this->db_name, $this->value);
             break;
         default:
     }
     $this->output = "\n" . $output . "\n" . $this->extra_output . "\n";
 }
Example #12
0
 public function build()
 {
     $output = "";
     $this->attributes["class"] = "form-control";
     if (parent::build() === false) {
         return;
     }
     switch ($this->status) {
         case "disabled":
         case "show":
             if ($this->type == 'hidden' || $this->value == "") {
                 $output = "";
             } elseif (!isset($this->value)) {
                 $output = $this->layout['null_label'];
             } else {
                 $output = "<img border=\"0\" src=\"//maps.googleapis.com/maps/api/staticmap?center={$this->value['lat']},{$this->value['lon']}&zoom={$this->zoom}&size=500x500\">";
             }
             $output = "<div class='help-block'>" . $output . "</div>";
             break;
         case "create":
         case "modify":
             $output = Form::hidden($this->lat, $this->value['lat'], ['id' => $this->lat]);
             $output .= Form::hidden($this->lon, $this->value['lon'], ['id' => $this->lon]);
             $output .= '<div id="map_' . $this->name . '" style="width:500px; height:500px"></div>';
             $output .= '<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>';
             \Rapyd::script("\n        \n            function initialize()\n            {\n                var latitude = document.getElementById('{$this->lat}');\n                var longitude = document.getElementById('{$this->lon}');\n                var zoom = {$this->zoom};\n        \n                var LatLng = new google.maps.LatLng(latitude.value, longitude.value);\n        \n                var mapOptions = {\n                    zoom: zoom,\n                    center: LatLng,\n                    panControl: false,\n                    zoomControl: true,\n                    scaleControl: true,\n                    mapTypeId: google.maps.MapTypeId.ROADMAP\n                }\n        \n                var map = new google.maps.Map(document.getElementById('map_{$this->name}'),mapOptions);\n        \n                var marker = new google.maps.Marker({\n                    position: LatLng,\n                    map: map,\n                    title: 'Drag Me!',\n                    draggable: true\n                });\n        \n                google.maps.event.addListener(marker, 'dragend', function (event) {\n                    latitude.value = event.latLng.lat();\n                    longitude.value = event.latLng.lng();\n                });\n        \n            }\n            initialize();\n        ");
             break;
         case "hidden":
             $output = '';
             //Form::hidden($this->db_name, $this->value);
             break;
         default:
     }
     $this->output = "\n" . $output . "\n" . $this->extra_output . "\n";
 }
 public function build()
 {
     $output = "";
     if (!isset($this->style)) {
         $this->style = "margin:0 2px 0 0; vertical-align: middle";
     }
     unset($this->attributes['id']);
     if (parent::build() === false) {
         return;
     }
     switch ($this->status) {
         case "disabled":
         case "show":
             if (!isset($this->value)) {
                 $output = $this->layout['null_label'];
             } else {
                 $output = $this->description;
             }
             $output = "<div class='help-block'>" . $output . "&nbsp;</div>";
             break;
         case "create":
         case "modify":
             $this->attributes['multiple'] = 'multiple';
             $this->attributes['data-placeholder'] = $this->attributes['placeholder'];
             $this->attributes['placeholder'] = null;
             $output .= Form::select($this->name . '[]', $this->options, $this->values, $this->attributes);
             $output .= $this->extra_output;
             break;
         case "hidden":
             $output = Form::hidden($this->name, $this->value);
             break;
         default:
     }
     $this->output = $output;
 }
Example #14
0
 public function build()
 {
     $output = "";
     $this->attributes["class"] = "form-control";
     if (parent::build() === false) {
         return;
     }
     switch ($this->status) {
         case "disabled":
         case "show":
             if ($this->type == 'hidden' || $this->value == "") {
                 $output = "";
             } elseif (!isset($this->value)) {
                 $output = $this->layout['null_label'];
             } else {
                 $output = nl2br(htmlspecialchars($this->value));
             }
             $output = "<div class='help-block'>" . $output . "</div>";
             break;
         case "create":
         case "modify":
             Rapyd::js('packages/zofe/rapyd/assets/tinymce/tinymce.min.js');
             $output = Form::textarea($this->db_name, $this->value, $this->attributes);
             $output .= Rapyd::script("\n          tinymce.init({\n            selector: 'textarea#" . $this->name . "',\n            plugins: [\n                 'advlist autolink link image lists charmap print preview hr anchor pagebreak',\n                 'searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking',\n                 'save table contextmenu directionality emoticons template paste textcolor responsivefilemanager'\n            ],\n            toolbar: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | responsivefilemanager | print preview media fullpage | forecolor backcolor emoticons', \n            image_advtab: true ,\n            external_filemanager_path:'" . URL::to('/') . "/packages/filemanager/',\n            filemanager_title:'Upload',\n          });");
             break;
         case "hidden":
             $output = Form::hidden($this->db_name, $this->value);
             break;
         default:
     }
     $this->output = "\n" . $output . "\n" . $this->extra_output . "\n";
 }
Example #15
0
 public function getValue()
 {
     Field::getValue();
     $this->values = explode($this->serialization_sep, $this->value);
     foreach ($this->values as $value) {
         $values[] = $this->isoDateToHuman($value);
     }
     if (isset($values)) {
         $this->value = implode($this->serialization_sep, $values);
     }
 }
Example #16
0
 public function build()
 {
     $output = "";
     if (parent::build() === false) {
         return;
     }
     switch ($this->status) {
         case "disabled":
         case "show":
             break;
         case "create":
         case "modify":
         case "hidden":
             $output = Form::hidden($this->name, $this->value);
             break;
         default:
     }
     $this->output = "\n" . $output . "\n" . $this->extra_output . "\n";
 }
Example #17
0
 public function build()
 {
     $output = "";
     if (parent::build() === false) {
         return;
     }
     switch ($this->status) {
         case "disabled":
         case "show":
         case "create":
         case "modify":
             $output = '<div>' . $this->parseString($this->pattern, $this->is_view) . '</div>';
             break;
         case "hidden":
             $output = "";
             break;
         default:
     }
     $this->output = "\n" . $output . "\n" . $this->extra_output . "\n";
 }
Example #18
0
 public function build()
 {
     $output = "";
     if (parent::build() === false) {
         return;
     }
     switch ($this->status) {
         case "disabled":
         case "show":
         case "create":
         case "modify":
             $output = $this->iframe();
             \Rapyd::script("\n                        if(typeof iframeAutoResize != 'function'){\n                            window.iframeAutoResize = function(id){\n                                var newheight;\n                                var newwidth;\n                \n                                if(document.getElementById){\n                                    newheight = document.getElementById(id).contentWindow.document .body.scrollHeight;\n                                    newwidth = document.getElementById(id).contentWindow.document .body.scrollWidth;\n                                }\n                \n                                document.getElementById(id).height = (newheight) + 'px';\n                                document.getElementById(id).width = (newwidth) + 'px';\n                            };\n                \n                        };\n                    ");
             break;
         case "hidden":
             $output = "";
             break;
         default:
     }
     $this->output = "\n" . $output . "\n" . $this->extra_output . "\n";
 }
Example #19
0
 public function build()
 {
     $output = "";
     unset($this->attributes['type']);
     if (parent::build() === false) {
         return;
     }
     switch ($this->status) {
         case "show":
             if (!isset($this->value)) {
                 $value = $this->layout['null_label'];
             } else {
                 $value = $this->isodatetimeToHuman($this->value);
             }
             $output = $value;
             $output = "<div class='help-block'>" . $output . "&nbsp;</div>";
             break;
         case "create":
         case "modify":
             if ($this->value != "") {
                 if (!$this->is_refill) {
                     $this->value = $this->isodatetimeToHuman($this->value);
                 }
             }
             Rapyd::css('datetimepicker/datetimepicker3.css');
             Rapyd::js('datetimepicker/bootstrap-datetimepicker.js');
             if ($this->language != "en") {
                 Rapyd::js('datetimepicker/locales/bootstrap-datetimepicker.' . $this->language . '.js');
             }
             $output = Form::text($this->name, $this->value, $this->attributes);
             Rapyd::script("\n                        \$('#" . $this->name . "').datetimepicker({\n                            format: '{$this->formatTodatetime()}',\n                            language: '{$this->language}',\n                            todayBtn: 'linked',\n                            autoclose: true\n                        });");
             break;
         case "hidden":
             $output = Form::hidden($this->db_name, $this->value);
             break;
         default:
     }
     $this->output = $output;
 }
 public function build()
 {
     $output = "";
     if (!isset($this->style)) {
         $this->style = "margin:0 2px 0 0; vertical-align: middle";
     }
     unset($this->attributes['id']);
     if (parent::build() === false) {
         return;
     }
     switch ($this->status) {
         case "disabled":
         case "show":
             if (!isset($this->value)) {
                 $output = $this->layout['null_label'];
             } else {
                 $output = $this->description;
             }
             $output = "<div class='help-block'>" . $output . "&nbsp;</div>";
             break;
         case "create":
         case "modify":
             //dd($this->options, $this->values);
             foreach ($this->options as $val => $label) {
                 $this->checked = in_array($val, $this->values);
                 //echo ((int)$this->checked)."<br />";
                 $output .= sprintf($this->format, Form::checkbox($this->name . '[]', $val, $this->checked) . $label) . $this->separator;
             }
             $output .= $this->extra_output;
             break;
         case "hidden":
             $output = Form::hidden($this->name, $this->value);
             break;
         default:
     }
     $this->output = $output;
 }
  public function build()
  {
    $output = "";
    if (parent::build() === false) return;

    switch ($this->status) {
      case "disabled":
      case "show":

        if ($this->type =='hidden' || $this->value == "") {
          $output = "";
        } elseif ( (!isset($this->value)) ) {
          $output = $this->layout['null_label'];
        } else {
          $output = nl2br(htmlspecialchars($this->value));
        }
        $output = "<div class='help-block'>".$output."&nbsp;</div>";
        break;

      case "create":
      case "modify":

        Rapyd::js('tinymce/tinymce.min.js');
        $output  = Form::textarea($this->name, $this->value, $this->attributes);
        Rapyd::script("tinymce.init({selector: '#".$this->name."'});");

        break;

      case "hidden":
        $output = Form::hidden($this->name, $this->value);
        break;

      default:;
    }
    $this->output = "\n".$output."\n". $this->extra_output."\n";
  }
Example #22
0
 public function build()
 {
     $this->path = $this->parseString($this->path);
     $this->web_path = $this->parseString($this->web_path);
     $output = "";
     if (parent::build() === false) {
         return;
     }
     switch ($this->status) {
         case "disabled":
         case "show":
             if ($this->type == 'hidden' || $this->value == "") {
                 $output = "";
             } elseif (!isset($this->value)) {
                 $output = $this->layout['null_label'];
             } else {
                 $output = nl2br(htmlspecialchars($this->value));
             }
             $output = "<div class='help-block'>" . $output . "&nbsp;</div>";
             break;
         case "create":
         case "modify":
             if ($this->old_value) {
                 $output .= '<div class="clearfix">';
                 $output .= link_to($this->web_path . $this->value, $this->value) . "&nbsp;";
                 $output .= Form::checkbox($this->name . '_remove', 1, (bool) Input::get($this->name . '_remove')) . " " . trans('rapyd::rapyd.delete') . " <br/>\n";
                 $output .= '</div>';
             }
             $output .= Form::file($this->name, $this->attributes);
             break;
         case "hidden":
             $output = Form::hidden($this->name, $this->value);
             break;
         default:
     }
     $this->output = "\n" . $output . "\n" . $this->extra_output . "\n";
 }
Example #23
0
    public function build()
    {
        $output = "";
        //typeahead
        Rapyd::css('autocomplete/autocomplete.css');
        Rapyd::js('autocomplete/typeahead.bundle.min.js');
        Rapyd::js('template/handlebars.js');
        //tagsinput
        Rapyd::css('autocomplete/bootstrap-tagsinput.css');
        Rapyd::js('autocomplete/bootstrap-tagsinput.min.js');
        unset($this->attributes['type']);
        if (parent::build() === false) {
            return;
        }
        switch ($this->status) {
            case "disabled":
            case "show":
                if (!isset($this->value)) {
                    $output = $this->layout['null_label'];
                } else {
                    $output = $this->description;
                }
                $output = "<div class='help-block'>" . $output . "&nbsp;</div>";
                break;
            case "create":
            case "modify":
                $output = Form::text($this->name, '', array_merge($this->attributes, array('id' => "" . $this->name))) . "\n";
                if ($this->remote) {
                    $script = <<<acp

                    \$('#{$this->name}').tagsinput({
                      itemValue: '{$this->record_id}',
                      itemText: '{$this->record_label}'
                    });
                    {$this->fill_tags}

                    var blod_{$this->name} = new Bloodhound({
                        datumTokenizer: Bloodhound.tokenizers.obj.whitespace('{$this->name}'),
                        queryTokenizer: Bloodhound.tokenizers.whitespace,
                        remote: '{$this->remote}?q=%QUERY'
                    });
                    blod_{$this->name}.initialize();

                    \$('#{$this->name}').tagsinput('input').typeahead(null, {
                        name: '{$this->name}',
                        displayKey: '{$this->record_label}',
                        highlight: true,
                        minLength: {$this->min_chars},
                        source: blod_{$this->name}.ttAdapter()
                    }).bind('typeahead:selected', \$.proxy(function (obj, data) {
                        this.tagsinput('add', data);
                        this.tagsinput('input').typeahead('val', '');
                    }, \$('#{$this->name}')));


acp;
                    Rapyd::script($script);
                } elseif (count($this->options)) {
                    $options = json_encode($this->local_options);
                    //options
                    $script = <<<acp

                    var {$this->name}_options = {$options};


                    \$('#{$this->name}').tagsinput({
                      itemValue: 'key',
                      itemText: 'value'
                    });
                    {$this->fill_tags}


                    var blod_{$this->name} = new Bloodhound({
                        datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
                        queryTokenizer: Bloodhound.tokenizers.whitespace,
                        local: {$this->name}_options
                    });


                    blod_{$this->name}.initialize();
                    \$('#{$this->name}').tagsinput('input').typeahead({
                         hint: true,
                         highlight: true,
                         minLength: {$this->min_chars}
                    },
                    {
                        name: '{$this->name}',
                        displayKey: 'value',
                        source: blod_{$this->name}.ttAdapter()
                    }).bind('typeahead:selected', \$.proxy(function (obj, data) {
                        this.tagsinput('add', data);
                        this.tagsinput('input').typeahead('val', '');
                    }, \$('#{$this->name}')));

acp;
                    Rapyd::script($script);
                }
                break;
            case "hidden":
                $output = Form::hidden($this->db_name, $this->value);
                break;
            default:
        }
        $this->output = "\n" . $output . "\n" . $this->extra_output . "\n";
    }
Example #24
0
    public function build()
    {
        $output = "";
        Rapyd::css('autocomplete/autocomplete.css');
        Rapyd::js('autocomplete/typeahead.bundle.min.js');
        Rapyd::js('template/handlebars.js');
        unset($this->attributes['type']);
        if (parent::build() === false) {
            return;
        }
        switch ($this->status) {
            case "disabled":
            case "show":
                if (!isset($this->value)) {
                    $output = $this->layout['null_label'];
                } elseif ($this->value == "") {
                    $output = "";
                } else {
                    if ($this->relation != null) {
                        $name = $this->rel_field;
                        $value = @$this->relation->get()->first()->{$name};
                    } else {
                        $value = $this->value;
                    }
                    $output = nl2br(htmlspecialchars($value));
                }
                $output = "<div class='help-block'>" . $output . "&nbsp;</div>";
                break;
            case "create":
            case "modify":
                if (Input::get("auto_" . $this->name)) {
                    $autocomplete = Input::get("auto_" . $this->name);
                } elseif ($this->relation != null) {
                    $name = $this->rel_field;
                    $autocomplete = @$this->relation->get()->first()->{$name};
                } elseif (count($this->local_options)) {
                    $autocomplete = $this->description;
                } else {
                    $autocomplete = $this->value;
                }
                $output = Form::text("auto_" . $this->name, $autocomplete, array_merge($this->attributes, array('id' => "auto_" . $this->name))) . "\n";
                $output .= Form::hidden($this->name, $this->value, array('id' => $this->name));
                $output = '<span id="th_' . $this->name . '">' . $output . '</span>';
                if ($this->remote) {
                    $script = <<<acp

                    var blod_{$this->name} = new Bloodhound({
                        datumTokenizer: Bloodhound.tokenizers.obj.whitespace('auto_{$this->name}'),
                        queryTokenizer: Bloodhound.tokenizers.whitespace,
                        remote: '{$this->remote}?q=%QUERY'
                    });
                    blod_{$this->name}.initialize();

                    \$('#th_{$this->name} .typeahead').typeahead(null, {
                        name: '{$this->name}',
                        displayKey: '{$this->record_label}',
                        highlight: true,
                        minLength: {$this->min_chars},
                        source: blod_{$this->name}.ttAdapter(),
                        templates: {
                            suggestion: Handlebars.compile('{{{$this->record_label}}}')
                        }
                    }).on("typeahead:selected typeahead:autocompleted",
                        function (e,data) { \$('#{$this->name}').val(data.{$this->record_id});

                    }).on("typeahead:closed",
                        function (e,data) {
                            if (\$(this).val() == '') {
                                \$('#{$this->name}').val('');
                            }
                    });
acp;
                    Rapyd::script($script);
                } elseif (count($this->options)) {
                    $options = json_encode($this->local_options);
                    //options
                    $script = <<<acp

                    var {$this->name}_options = {$options};
                    var blod_{$this->name} = new Bloodhound({
                        datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
                        queryTokenizer: Bloodhound.tokenizers.whitespace,
                        local: {$this->name}_options
                    });


                    blod_{$this->name}.initialize();

                    \$('#th_{$this->name} .typeahead').typeahead({
                         hint: true,
                         highlight: true,
                         minLength: {$this->min_chars}
                    },
                    {
                        name: '{$this->name}',
                        displayKey: 'value',
                        source: blod_{$this->name}.ttAdapter()
                    }).on("typeahead:selected typeahead:autocompleted",
                        function (e,data) {
                            \$('#{$this->name}').val(data.key);
                    }).on("typeahead:closed",
                        function (e,data) {
                            if (\$(this).val() == '') {
                                \$('#{$this->name}').val('');
                            }
                    });
acp;
                    Rapyd::script($script);
                }
                break;
            case "hidden":
                $output = Form::hidden($this->db_name, $this->value);
                break;
            default:
        }
        $this->output = "\n" . $output . "\n" . $this->extra_output . "\n";
    }