diff options
Diffstat (limited to 'protected/views/myAngebot/_form.php')
| -rw-r--r-- | protected/views/myAngebot/_form.php | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/protected/views/myAngebot/_form.php b/protected/views/myAngebot/_form.php index f48ecc9..b52a5cc 100644 --- a/protected/views/myAngebot/_form.php +++ b/protected/views/myAngebot/_form.php @@ -11,12 +11,34 @@ <div class="row"> <?php echo $form->labelEx($model, 'angebot_id'); ?> - <?php echo $this->widget('zii.widgets.jui.CJuiAutoComplete', array( - 'name'=>'city', - 'source'=>array('ac1', 'ac2', 'ac3'), + <?php $this->widget('zii.widgets.jui.CJuiAutoComplete', array( + 'name'=>'angebot_name', + 'source'=>$angebote, + 'value'=>$model->angebot->name, // additional javascript options for the autocomplete plugin 'options'=>array( 'minLength'=>'2', + 'select'=>'js:function(event,ui) { + $("#AngebotVerein_angebot_id").val(ui.item.value); + $("#angebot_name").val(ui.item.label); + var selectObj = $("#AngebotVerein_einheit")[0]; + var selectParentNode = selectObj.parentNode; + var newSelectObj = selectObj.cloneNode(false); // Make a shallow copy + selectParentNode.replaceChild(newSelectObj, selectObj); + var count = 0; + var einheiten = ui.item.einheiten.split(","); + for (i in einheiten) { + var str = einheiten[i].replace(/^\s+/, ""); + for (var i = str.length - 1; i >= 0; i--) { + if (/\S/.test(str.charAt(i))) { + str = str.substring(0, i + 1); + break; + } + } + newSelectObj.options[count++] = new Option(str, str); + } + return false; + }' ), 'htmlOptions'=>array( 'style'=>'height:20px;' @@ -38,6 +60,12 @@ </div> <div class="row"> + <?php echo $form->labelEx($model,'einheit'); ?> + <?php echo Html::einheitenDropDownList($model, 'einheit', $einheiten)?> + <?php echo $form->error($model,'einheit'); ?> + </div> + + <div class="row"> <?php echo $form->labelEx($model,'published'); ?> <?php echo $form->checkbox($model,'published'); ?> <?php echo $form->error($model,'published'); ?> |
