2

I have a dropdownlist in a activeform like this

<?= $form->field($model, 'emailTemplateId')->dropDownList($emailTemplateIds, ['prompt'=>'-Choose an Email Template-'] ?> 

and I want to send its selected value in below link's parameter.

Like this:

<?= Html::a('Send', ['invoice/send-invoice', 'emailTemplateId' => $emailTemplateIds] ) ?> 

How its done?

2
  • Use from jquery (select option value and send it to your link) . Jquery help link : learn.jquery.com/using-jquery-core/faq/… Commented Jan 8, 2016 at 6:03
  • in action, I'm receiving nothing Commented Jan 8, 2016 at 6:11

1 Answer 1

1

Use jquery to do this

<?= $form->field($model, 'emailTemplateId')->dropDownList($emailTemplateIds, ['prompt'=>'-Choose an Email Template-', 'id'=>'select'] ?> <?= Html::a('Send', ['invoice/send-invoice', 'emailTemplateId' => 0], ['id' => 'send'] ) ?> jQuery Part $("#select").change(function(){ var text = $("#send").attr("href"); href = text.replace(/(emailTemplateId=)[^\&]+/, '$1' + $(this).val()); $("#send").attr("href", href); }) 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.