Problem with - External Data Get drop down list options

Moderator: crythias

Post Reply
FiL
Znuny newbie
Posts: 69
Joined: 13 Jul 2010, 18:02
Znuny Version: 2.4.7

Problem with - External Data Get drop down list options

Post by FiL »

I tried the HowTo viewtopic.php?f=60&t=17033

I created the extdata file and http://otrsserver/otrs/extdata.pl?q=ro worked.

But when I tried to implement it with jquery into the AgentDashboard.dtl it doesn´t work

Code: Select all

<select id="myselect" name="DynamicField_fieldName">
        <script type="text/javascript">
            $.get('http://ip/otrs/extdata.pl', function(data) {
               $('#myselect').append(data);
        });
        </script>
    </select>
There is nothing in the dropdown menu.

Any ideas?
Dev
OTRS-Version: 3.1.7
System: Ubuntu Linux

Prod
OTRS-Version 3.0.9
System: Ubuntu Linux
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Problem with - External Data Get drop down list options

Post by crythias »

a couple of things:
1) While the example works, the Script doesn't need to be where it is (inside the select) ... it probably should be in the Footer
2) jquery needs to be loaded. (It's by default only loaded for forms.)
3) you need to modify "ip" to be your otrsserver.

You could put this in Kernel/Output/HTML/Standard/HTMLHead.dtl
<script src ="$Config{"Frontend::WebPath"}js/thirdparty/jquery-1.6.4/jquery.js"></script>
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
FiL
Znuny newbie
Posts: 69
Joined: 13 Jul 2010, 18:02
Znuny Version: 2.4.7

Re: Problem with - External Data Get drop down list options

Post by FiL »

I loaded it in the HTMLHead.dtl but still nothing happens.
And put the script part outside of the select. Still nothing
Dev
OTRS-Version: 3.1.7
System: Ubuntu Linux

Prod
OTRS-Version 3.0.9
System: Ubuntu Linux
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Problem with - External Data Get drop down list options

Post by crythias »

Inspect element, go to the console (Chrome) and see what's going on.
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
eterjack
Znuny newbie
Posts: 55
Joined: 21 Sep 2012, 01:45
Znuny Version: 3.1.10

Re: Problem with - External Data Get drop down list options

Post by eterjack »

Hello,

What files should I change to add this functionality to a DynamicField ?

I create a file extdata.pl, and the select is work perfectly.

But i dont know, in what file, add
<select id="myselect" name="DynamicField_cat3"></select>
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Problem with - External Data Get drop down list options

Post by crythias »

eterjack wrote:What files should I change to add this functionality to a DynamicField ?
Kernel/Output/HTML/Standard/ .dtl file that represents the page you wish to show the Dynamic Field.

You don't *have* to create the field. You just need to know the id of the field that needs to have the data populated.
"How?"
view the source/inspect element where you expect the data to fill.
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
StefanoBoccanera
Znuny newbie
Posts: 76
Joined: 23 Feb 2011, 15:43
Znuny Version: 3.1.5
Real Name: Stefano Boccanera
Company: I.Conseils (self-employee)
Location: Rome (Italy)

Re: Problem with - External Data Get drop down list options

Post by StefanoBoccanera »

Hi crythias

I'd like to use your suggestion, but with a slightly modification.

My perl module would put data reading it form one or more text file depending on a paramater passed by $.get jquery statement. So i have some questions :

How I have to modify the jquery script to pass this parameter ?
Can I use a variable set with a value (or a substring of it) from another dynamic dropdown field value?
How i have to define the dynamic_field ? I suppose should be not a dropdown but a single text filed is it right?

Finally I assume, for perl module, that parameter will be ARGV[0] .....

best regards

stefano
Stefano Boccanera

OTRS : 3.1.5
ITSM : 3.1
S.O : RH
RDBMS : Postgres
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Problem with - External Data Get drop down list options

Post by crythias »

StefanoBoccanera wrote:My perl module would put data reading it form one or more text file depending on a paramater passed by $.get jquery statement
If I understand your question ... I'm not sure you need a file like extdata.pl ... you may want to look at different options: http://stackoverflow.com/questions/6470 ... t-into-div

without having any idea what you want to do, the basics are:
the field that is the master field needs to have an onchange that passes the master field's value to the function that provides the result to the subordinate field.

master field: If you change this field, the subordinate field changes. Needs to have an onchange attribute. Can be any type of input. If you need to store this value, it should be a Dynamic Field. If you don't need to store this value, you still need to modify the .dtl to show it.

subordinate field: empty until filled. does not have to have an onchange attribute. If it's being filled with a single value, can be a basic text input. If it's being filled with a drop down list should be a select input. Either way, this should be defined in Dynamic Fields.


Please don't cross post ... pick a single place for your topic and let's discuss it.
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
Post Reply