Hi
Newbie to Yii and looking for someone to advise how the following would be handled in the controller?
having already searched the forum but could not find the solution.
I have a single view which contains both a delivery address & a billing address.
I would like the user to be able to select a checkbox which would then auto populate all the billing fields with the same information as the delivery address.
If the user un-checks the checkbox then the billing address reverts back to been empty.
This is a sample from our _form.php view:
<fieldset>
<legend>Address Details</legend>
<div>
<?php echo $form->labelEx($model,'street_1'); ?>
<?php echo $form->textField($model,'address_street_1',array('size'=>60,'maxlength'=>255,'placeholder'=>'Street 1')); ?>
</div>
......
</fieldset>
<div>
<?php echo $form->labelEx($model,'billing_same'); ?>
<?php echo $form->checkBox($model, 'billing_same', array('value'=>'Yes', 'uncheckValue'=>'No')); ?>
</div>
<fieldset>
<legend>Billing Details</legend>
<div>
<?php echo $form->labelEx($model,'street_1'); ?>
<?php echo $form->textField($model,'billing_address_street_1',array('size'=>60,'maxlength'=>255,'placeholder'=>'Street 1')); ?>
</div>
......
</fieldset>
In the actionIndex do i need a if statement which would loop through something similar to:
form.billing_address_street_1.value = form.address_street_1.value;
??
Any help would be most appreciated
Thank you