DynamicFields filled per JSON

Moderator: crythias

Locked
Blang
Znuny newbie
Posts: 10
Joined: 06 Sep 2010, 12:12
Znuny Version: 3.1.x

DynamicFields filled per JSON

Post by Blang »

Hey there,

I'm trying to fill a DynamicField (Type: Select) with content of an ajax (json) request.

This works quite well, but everytime the fields looses the focus or any other Dropdown-field gets selected, the content
of the Selectbox gets replaced by the Defaultvalues configured in DynamicField-Settings.

Can anybody give me a hint how to disable the default 'FormUpdate' for one single Field or how to
populate a DynamicField-Selectbox with JSON-Data?

Kind regards,
Blang
"Produktiv": OTRS: 3.1.x
OS: SUSE Linux Enterprise Server 11
Apache2/MySQL 5.5
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: DynamicFields filled per JSON

Post by crythias »

Disclaimer: I haven't extensively worked with 3.1, but if the changes are relatively minimal, the fields that are updated are indicated in the onChange of the fields to be updated. Removing fields-to-be-updated from that part in the .dtl should help.
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
Blang
Znuny newbie
Posts: 10
Joined: 06 Sep 2010, 12:12
Znuny Version: 3.1.x

Re: DynamicFields filled per JSON

Post by Blang »

The problem is, that the new dynamicfields don't have an 'onchange' flag in the dtl-files. I don't know where
the onchange comes from.

This is how the block in .dtl looks like:

Code: Select all

<!-- dtl:block:DynamicField_StandortGebaeude -->
                    <div class="Row Row_DynamicField_$QData{"Name"}">
                        $Data{"Label"}
                        <div class="Field">
                            $Data{"Field"}
                        </div>
                        <div class="Clear"></div>
                    </div>
<!-- dtl:block:DynamicField_StandortGebaeude -->
"Produktiv": OTRS: 3.1.x
OS: SUSE Linux Enterprise Server 11
Apache2/MySQL 5.5
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: DynamicFields filled per JSON

Post by crythias »

Blang wrote:everytime the fields looses the focus or any other Dropdown-field gets selected, the content
of the Selectbox gets replaced by the Defaultvalues configured in DynamicField-Settings.
if the field goes back to defaults onblur, that doesn't make sense unless view source says so.
If the field goes back to default based upon change in another dropdown box, that is the control that determines what *else* gets updated onchange. (Again, view source/inspect element.)
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
Blang
Znuny newbie
Posts: 10
Joined: 06 Sep 2010, 12:12
Znuny Version: 3.1.x

Re: DynamicFields filled per JSON

Post by Blang »

To inspect the sourcecode was a good idea. I found the following code but i still don't know where it comes from and
how to remove it. To code isn't in the .dtl - file.

Code: Select all

$('#DynamicField_StandortGebaeude').bind('change', function (Event) {
        Core.AJAX.FormUpdate($(this).parents('form'), 'AJAXUpdate', 'DynamicField_StandortGebaeude', [ 'TypeID', 'Dest', 'ServiceID', 'SLAID', 'NewUserID', 'NewResponsibleID', 'NextStateID', 'PriorityID', 'DynamicField_NetType' ]);
    });
I also found why the field gets updated onchange of other select-fields:

Code: Select all

Core.AJAX.FormUpdate($('#NewPhoneTicket'), 'AJAXUpdate', 'Dest', ['TypeID', 'NewUserID', 'NewResponsibleID', 'NextStateID', 'PriorityID', 'ServiceID', 'SLAID', 'SignKeyID', 'CryptKeyID', 'DynamicField_NetType', 'DynamicField_StandortGebaeude', 'To', 'Cc', 'Bcc']);
This can be fixed, because the code is in the .dtl file

Code: Select all

Core.AJAX.FormUpdate($('#NewPhoneTicket'), 'AJAXUpdate', 'TypeID', ['Dest', 'NewUserID', 'NewResponsibleID', 'NextStateID','PriorityID', 'ServiceID', 'SLAID', 'SignKeyID', 'CryptKeyID', $Data{"DynamicFieldNamesStrg"}, 'To', 'Cc', 'Bcc']);
"Produktiv": OTRS: 3.1.x
OS: SUSE Linux Enterprise Server 11
Apache2/MySQL 5.5
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: DynamicFields filled per JSON

Post by crythias »

I didn't get what form (action) you were filling out?
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
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: DynamicFields filled per JSON

Post by crythias »

Sorry. Read too fast. Chances are anything not in the dtl is in Layout
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
Blang
Znuny newbie
Posts: 10
Joined: 06 Sep 2010, 12:12
Znuny Version: 3.1.x

Re: DynamicFields filled per JSON

Post by Blang »

I'll search for it in the layout. Thanks for the hint!

But if it's located there, i think - that's a very bad behavior to put 'logic'-elements like 'updating-fields' in the
layout :(
"Produktiv": OTRS: 3.1.x
OS: SUSE Linux Enterprise Server 11
Apache2/MySQL 5.5
Locked