Note that there are some explanatory texts on larger screens.

plurals
  1. POAdd create new link in Yii Framework drop down list
    text
    copied!<p>I am a newbie in Yii Framework and doing a small application in <code>Yii Framework</code>, I have the database for <code>Invoice</code> and <code>Customers</code> like this</p> <pre><code> ==== Invoice ==== id customer_id invoice_title invoice_no invoice_issue_date created_by updatd_by === Customers === id customer_name address business_address city state </code></pre> <p>Now as per my requirment I need all the available customer name should come in a <code>dropdown</code> list in Invoice create form so I made changes in <code>Invoice form.php</code> to call all the available customers name like this</p> <pre><code>&lt;div class="row"&gt; &lt;?php echo $form-&gt;labelEx($customers,'customer_name'); ?&gt; &lt;?php echo $form-&gt;dropdownList($customers,'customer_name', CHtml::listData(Customers::model()-&gt;findAll(), 'id', 'customer_name'), array('empty'=&gt;'Choose one')); ?&gt; &lt;?php echo $form-&gt;error($customers,'customer_name'); ?&gt; &lt;/div&gt; </code></pre> <p>It is showing the available <code>customers name</code> from the <code>customer table</code>.But I need one thing more.That is it will show an addition link in dropdown called as <code>Create One</code>.Where the admin will click on this link and one <code>lightbox</code> will come with the <code>create customer form</code> where all the data entered will be save in the <code>customer table</code>.I am also uploading some images for reference.Any help and suggestions will be highly appreciable.Reference image has been uploaded here.<img src="https://i.stack.imgur.com/5WoPk.jpg" alt="enter image description here"></p> <p><strong>[Update]</strong> I have gone one step forward and made this changes</p> <pre><code> &lt;div class="row"&gt; &lt;?php echo $form-&gt;labelEx($customers,'customer_name'); ?&gt; &lt;div id="job"&gt; &lt;?php echo $form-&gt;dropDownList($customers,'customer_name',CHtml::listData(Customers::model()-&gt;findAll(),'id','customer_name'),array('prompt'=&gt;'Select')); ?&gt; &lt;?php echo CHtml::ajaxLink(Yii::t('customers','Create customers'),$this-&gt;createUrl('customers/create'),array( 'onclick'=&gt;'$("#customers").dialog("open"); return false;', 'update'=&gt;'#jobDialog' ),array('id'=&gt;'showJobDialog'));?&gt; &lt;div id="jobDialog"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>It is working But I want <code>create Customers</code> link inside the drop down list not outside the dropdown.So how to do that?Any help and suggestion will be highly appreciable.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload