Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- $(document).ready(function(e) {
- $("input[type=checkbox]").click(function(){
- if ($(this).attr("checked") == "checked"){
- $("#DistributionPlan_ship_pic_name").attr("readonly","readonly");
- $("#DistributionPlan_ship_pic_phone").attr("readonly","readonly");
- $("#DistributionPlan_ship_pic_mobile").attr("readonly","readonly");
- $("#DistributionPlan_ship_title").attr("readonly","readonly");
- $("#DistributionPlan_ship_address").attr("readonly","readonly");
- $("#DistributionPlan_ship_province").attr("readonly","readonly");
- $("#DistributionPlan_ship_city").attr("readonly","readonly");
- $("#DistributionPlan_zip_code").attr("readonly","readonly");
- checkData();
- }else{
- $("#DistributionPlan_ship_pic_name").removeAttr("readonly");
- $("#DistributionPlan_ship_pic_phone").removeAttr("readonly");
- $("#DistributionPlan_ship_pic_mobile").removeAttr("readonly");
- $("#DistributionPlan_ship_title").removeAttr("readonly");
- $("#DistributionPlan_ship_address").removeAttr("readonly");
- $("#DistributionPlan_ship_province").removeAttr("readonly");
- $("#DistributionPlan_ship_city").removeAttr("readonly");
- $("#DistributionPlan_zip_code").removeAttr("readonly");
- //==========================================================
- $("#DistributionPlan_ship_pic_name").val('');
- $("#DistributionPlan_ship_pic_phone").val('');
- $("#DistributionPlan_ship_pic_mobile").val('');
- $("#DistributionPlan_ship_title").val('');
- $("#DistributionPlan_ship_address").val('');
- $("#DistributionPlan_ship_province").val('');
- $("#DistributionPlan_ship_city").val('');
- $("#DistributionPlan_zip_code").val('');
- $("#DistributionPlan_ship_pic_name").focus();
- }
- });
- });
- function checkData(){
- $.ajax({
- type: 'GET',
- url: '<?php echo Yii::app()->createAbsoluteUrl("distributionplan/matchdata"); ?>',
- dataType: 'json',
- cache: false,
- success: function (result) {
- $("#DistributionPlan_ship_pic_name").val(result[0].pic_name);
- $("#DistributionPlan_ship_pic_phone").val(result[0].pic_phone_number);
- $("#DistributionPlan_ship_pic_mobile").val(result[0].pic_mobile_number);
- $("#DistributionPlan_ship_title").val(result[0].region_office_title);
- $("#DistributionPlan_ship_address").val(result[0].region_address);
- $("#DistributionPlan_ship_province").val(result[0].province);
- $("#DistributionPlan_ship_city").val(result[0].city);
- $("#DistributionPlan_zip_code").val(result[0].zip_code);
- $("html, body").animate({ scrollTop: $(document).height() }, "slow");
- },
- error: function(jqXHR, exception){
- alert('Error : Match region data');
- }
- });
- }
- </script>
- <input type="checkbox" id="copyData" class="css-checkbox med"/>
- <label for="copyData" name="copyData_lbl" class="css-label med elegant">Copy from current data</label>
- <br /><br />
- <div class="formSep">
- <label>
- <?php echo $form->labelEx($model,'ship_pic_name'); ?>
- </label>
- <?php echo $form->textField($model,'ship_pic_name',array('size'=>50,'maxlength'=>50,'autocomplete'=>'off')); ?>
- <span class="help-inline">
- <?php echo $form->error($model,'ship_pic_name'); ?>
- </span>
- <label>
- <?php echo $form->labelEx($model,'ship_pic_phone'); ?>
- </label>
- <?php echo $form->textField($model,'ship_pic_phone',array('size'=>50,'maxlength'=>50,'autocomplete'=>'off')); ?>
- <span class="help-inline">
- <?php echo $form->error($model,'ship_pic_phone'); ?>
- </span>
- <label>
- <?php echo $form->labelEx($model,'ship_pic_mobile'); ?>
- </label>
- <?php echo $form->textField($model,'ship_pic_mobile',array('size'=>50,'maxlength'=>50,'autocomplete'=>'off')); ?>
- <span class="help-inline">
- <?php echo $form->error($model,'ship_pic_mobile'); ?>
- </span>
- <label>
- <?php echo $form->labelEx($model,'ship_title'); ?>
- </label>
- <?php echo $form->textField($model,'ship_title',array('size'=>60,'maxlength'=>100,'autocomplete'=>'off')); ?>
- <span class="help-inline">
- <?php echo $form->error($model,'ship_title'); ?>
- </span>
- <label>
- <?php echo $form->labelEx($model,'ship_address'); ?>
- </label>
- <?php echo $form->textArea($model,'ship_address',array('rows'=>6, 'cols'=>50, 'class'=>'span7')); ?>
- <span class="help-inline">
- <?php echo $form->error($model,'ship_address'); ?>
- </span>
- <label>
- <?php echo $form->labelEx($model,'ship_province'); ?>
- </label>
- <?php echo $form->textField($model,'ship_province',array('size'=>50,'maxlength'=>50,'autocomplete'=>'off')); ?>
- <span class="help-inline">
- <?php echo $form->error($model,'ship_province'); ?>
- </span>
- <label>
- <?php echo $form->labelEx($model,'ship_city'); ?>
- </label>
- <?php echo $form->textField($model,'ship_city',array('size'=>50,'maxlength'=>50,'autocomplete'=>'off')); ?>
- <span class="help-inline">
- <?php echo $form->error($model,'ship_city'); ?>
- </span>
- <label>
- <?php echo $form->labelEx($model,'zip_code'); ?>
- </label>
- <?php echo $form->textField($model,'zip_code',array('size'=>60,'maxlength'=>255,'autocomplete'=>'off')); ?>
- <span class="help-inline">
- <?php echo $form->error($model,'zip_code'); ?>
- </span>
- </div>
- <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save', array('class' => 'btn btn-success')); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement