OnChange Event on dropdown

Moderator: crythias

Locked
mohsinkhan009
Znuny newbie
Posts: 64
Joined: 02 Sep 2015, 08:47
Znuny Version: OTRS-Rel-5

OnChange Event on dropdown

Post by mohsinkhan009 »

Hi all,

Need Help in adding OnChange event in below coded

Code: Select all

<!-- dtl:block:Priority -->
                <div>
                    <label for="PriorityID">$Text{"Priority"}:</label>
                    $Data{"PriorityStrg"}
                <div class="Clear"></div>
                </div>
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
    $('#PriorityID').bind('change', function (Event) {
        Core.AJAX.FormUpdate($('#NewCustomerTicket'), 'AJAXUpdate', 'PriorityID', [ 'TypeID', 'Dest', 'ServiceID', 'SLAID', $Data{"DynamicFieldNamesStrg"}]);
    });
//]]>
function changetextbox()
{
    if (document.getElementById("PriorityID").value === "1") {
        document.getElementById("CustomerEffect").disable='true';
    } else {
        document.getElementById("CustomerEffect").disable='false';
    }
}

</script>
in CustomerTicketMessage.dtl where should I insert OnChange="changetextbox() in drop down
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: OnChange Event on dropdown

Post by crythias »

not that it will survive changes, but you're looking at it...

The bind('change is jquery for onChange.

What you want to do is modify/replace the function.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
mohsinkhan009
Znuny newbie
Posts: 64
Joined: 02 Sep 2015, 08:47
Znuny Version: OTRS-Rel-5

Re: OnChange Event on dropdown

Post by mohsinkhan009 »

Finally I go the solution and it is working awesome, also added other javascript event. :-)
aph
Znuny superhero
Posts: 646
Joined: 20 Jun 2014, 12:11
Znuny Version: 3.3.9, 4.x, 5.x

Re: OnChange Event on dropdown

Post by aph »

I suggest you create a custom theme and place your .dtl in the custom folder unde ..../otrs/Kernel/Output/HTML.
OTRS 3.3.x (private/testing) on Windows Server 2008 with MSSQL database.
OTRS 3.3.x (private/testing) on CentOS with MySQL database and apache
Locked