I have a problem with run function during onchange event.
I want to put to the Subject input text selected from queues list in Customer New Ticket Form.
I have added onchange="updateSubject()" in LayoutTicket.pm
Code: Select all
# build tree list
$Param{MoveQueuesStrg} = '<select name="'
. $Param{Name}
. '" id="'
. $Param{Name}
. '" class="'
. $Class
. '"onchange="updateSubject()"'
. "\ $Size $Multiple $OnChangeSubmit>\n";
Code: Select all
[% RenderBlockStart("Queue") %]
<div>
<label for="Dest" class="Mandatory">
<span class="Marker">*</span>
[% Translate("Category") | html %]:
</label>
[% Data.ToStrg %]
<div id="DestError" class="TooltipErrorMessage" ><p>[% Translate("This field is required.") | html %]</p></div>
<div id="DestServerError" class="TooltipErrorMessage NoJavaScriptMessage[% Data.QueueInvalid | html %]" ><p>[% Translate("This field is required.") | html %]</p></div>
<div class="Clear"></div>
</div>
[% WRAPPER JSOnDocumentComplete %]
<script type="text/javascript">//<![CDATA[
$('#Dest').bind('change', function (Event) {
Core.AJAX.FormUpdate($('#NewCustomerTicket'), 'AJAXUpdate', 'Dest', ['TypeID', 'PriorityID', 'ServiceID', 'SLAID', [% Data.DynamicFieldNamesStrg %]]);
});
//]]>
function updateSubject(){
var s = document.getElementById('Dest');
var strS = s.options[s.selectedIndex].text;
document.getElementById('Subject').value = strS;
}
</script>
[% END %]