Read only dynamic field

Moderator: crythias

Locked
th13fp45s
Znuny newbie
Posts: 27
Joined: 14 May 2012, 16:22
Znuny Version: 3.3.x
Real Name: Alexandre Muzzio

Read only dynamic field

Post by th13fp45s »

Hi guys,

I am looking for a way to add a dynamic field where the user cannot change the text box content, or just add the dynamic field label, there is some way to do that?

I see the file /opt/otrs/Kernel/Output/HTML/Standard/CustomerTicketMessage.dtl on block:

Code: Select all

#<!-- dtl:block:DynamicField_Field1 -->
#                <div class="Row Row_DynamicField_$QData{"Name"}">
#                    $Data{"Label"}
#                    <div class="Field">
#                        $Data{"Field"}
#                    </div>
#                    <div class="Clear"></div>
#                </div>
#<!-- dtl:block:DynamicField_Field1 -->

Theoretically, if I change Field1 for my field name and remove the block above it will work, but this changes doesnt work...

# <div class="Field">
# $Data{"Field"}
# </div

Can someone help me please?
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Read only dynamic field

Post by crythias »

th13fp45s wrote:I am looking for a way to add a dynamic field where the user cannot change the text box content, or just add the dynamic field label, there is some way to do that?
Why bother adding a dynamic field if the information never changes?
or,
If you want a select box, make the dynamic field a select box with one entry.

Dynamic fields will display when you enable them to display.
They will be changeable where you enable them to be changed in certain forms.
If you want values that have been input once to never change, just print the values.
Don't try to print a label and a field for something you just want to print data. Look at $QData{"DynamicField_fieldname"}
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
th13fp45s
Znuny newbie
Posts: 27
Joined: 14 May 2012, 16:22
Znuny Version: 3.3.x
Real Name: Alexandre Muzzio

Re: Read only dynamic field

Post by th13fp45s »

Thanks crythias,

Let me explain better the problem. On new ticket form from customer I have a lot of Dynamic Fields and I would like to separate them on labeled sections, like:

Network

Enter Server IP: Textbox
Name: TextBox

Backup

Do you have backup? Droplist

So, Network and Backup would be labels. There any way to create labels on this screen?
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Read only dynamic field

Post by crythias »

Look at the rendered page (view source) for hints.
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
th13fp45s
Znuny newbie
Posts: 27
Joined: 14 May 2012, 16:22
Znuny Version: 3.3.x
Real Name: Alexandre Muzzio

Re: Read only dynamic field

Post by th13fp45s »

crythias, but this page is dynamically generated, the code above on file /opt/otrs/Kernel/Output/HTML/Standard/CustomerTicketMessage.dtl is responsible to generate this code, correct?

Code: Select all

<!-- dtl:block:DynamicField -->
                <div class="Row Row_DynamicField_$QData{"Name"}">
                    $Data{"Label"}
                    <div class="Field">
                        $Data{"Field"}
                    </div>
                    <div class="Clear"></div>
                </div>
<!-- dtl:block:DynamicField -->
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Read only dynamic field

Post by crythias »

Yes. Maybe I'm unclear what you'd like to see happen.
If you want labels on dynamic fields, they'd be autogenerated from what you told OTRS you'd like to label the DynamicField.
You'd also enable them on the Customer Screen within SysConfig if you want them to appear dynamically (What's in SysConfig shows on the screen). If you want to enable them statically (directly in the .dtl), take a look at the commented section

Code: Select all

#<!-- dtl:block:DynamicField_Field1 -->
#                <div class="Row Row_DynamicField_$QData{"Name"}">
#                    $Data{"Label"}
#                    <div class="Field">
#                        $Data{"Field"}
#                    </div>
#                    <div class="Clear"></div>
#                </div>
#<!-- dtl:block:DynamicField_Field1 -->
and make appropriate adjustments (Field1 is to be replaced with the actual name of the field).
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
th13fp45s
Znuny newbie
Posts: 27
Joined: 14 May 2012, 16:22
Znuny Version: 3.3.x
Real Name: Alexandre Muzzio

Re: Read only dynamic field

Post by th13fp45s »

crythias, I could solve my problem with this code, but it doesnt work! Look, let's suppose that dynamic field name be Cliente, if I would like to add it statically, is the code above correct?

Code: Select all

<!-- dtl:block:DynamicField_Cliente -->
                <div class="Row Row_DynamicField_$QData{"Name"}">
                    $Data{"Label"}
                    <div class="Field">
                        $Data{"Field"}
                    </div>
                    <div class="Clear"></div>
                </div>
<!-- dtl:block:DynamicField_Cliente -->
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Read only dynamic field

Post by crythias »

What screen are we modifying?
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
th13fp45s
Znuny newbie
Posts: 27
Joined: 14 May 2012, 16:22
Znuny Version: 3.3.x
Real Name: Alexandre Muzzio

Re: Read only dynamic field

Post by th13fp45s »

./Kernel/Output/HTML/Standard/CustomerTicketMessage.dtl

New ticket from customer user.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Read only dynamic field

Post by crythias »

It won't show if the field is not enabled in SysConfig, and *THEN* it will double print if both the "listing" block (<!-- dtl:block:DynamicField -->) exists AND the "entry" block (<!-- dtl:block:DynamicField_Field1 -->) exists (so comment out the listing block if you want a specific placement/order.)

But I think that would have properly answered earlier: enable the entry in SysConfig for the screen.

"Where?"
Edit Config Settings in Ticket -> Frontend::Customer::Ticket::ViewNew, at the bottom, click +, the field name, and a 0 for disabled, 1 for enabled/optional and 2 for required/mandatory.

"Disabled?"
It's the same as not entering it, but you may choose to enter it as a placeholder.
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
Locked