Zen Cart Logo
Forums / Customization from the Admin / Auto populate Comments in admin order page

Auto populate Comments in admin order page

Views: 1,749

Results 1 to 2 of 2
09 Aug 2013, 16:06
#1
time111 avatar

time111

New Zenner

Join Date:
Sep 2008
Posts:
95
Plugin Contributions:
0

Auto populate Comments in admin order page

Hi!

Im trying to put few predefined comments in order page in admin like Shipping done by XX shipper etc. For that im using below given code & its working in plain test .htm file, but not in actual orders page. Unable to understand where im going wrong.

orders.php in <head> section

<script type="text/JavaScript">

function showText(){
var F, opt;
F = document.oForm;
opt = F.commentsPopulate.options;

F.comments.value = opt[opt.selectedIndex].text;

}
</script>

orders.php in <body> section

<?php echo zen_draw_textarea_field('comments', 'soft', '60', '5'); ?>
.........................................
     <select name="commentsPopulate" onchange="showText()">
        <option value="test1">test1</option>
        <option value="test2">test2</option>
        <option value="test3">test3</option>
        <option value="test4">test4</option>
    </select>

~Time

13 Aug 2013, 18:37
#2
responsivezc avatar

responsivezc

New Zenner

Join Date:
Aug 2013
Posts:
85
Plugin Contributions:
8

Re: Auto populate Comments in admin order page

Hi,

This is the code you should be using

<script type="text/JavaScript">

function showText(){
var F, opt;
F = document.status;
opt = F.commentsPopulate.options;

F.comments.value = opt[opt.selectedIndex].text;

}
</script>

The form name is status and not oForm

This would be a great idea for a plugin.
Can you share your predefined comments list ?