How to Retrieve form data on perl module

English! place to talk about development, programming and coding
Post Reply
GMunjal
Znuny advanced
Posts: 108
Joined: 23 Oct 2013, 09:17
Znuny Version: 3.3.0 beta 2
Real Name: Gaurav Munjal
Company: Nagarro

How to Retrieve form data on perl module

Post by GMunjal »

Hi,

I am developing a new ticket menu module and I want to know how can I retrieve data in perl module sent from the .dtl file after clicking submit button in the form. Please have a look at the web page. The data will be selected checkboxes.
Untitled picture.png

Thanks
Gaurav
You do not have the required permissions to view the files attached to this post.
mabu
Znuny newbie
Posts: 3
Joined: 05 Dec 2013, 12:18
Znuny Version: Version 3.3

Re: How to Retrieve form data on perl module

Post by mabu »

Hello Gaurav,

normally you have forms like this:

Code: Select all

<form action="$Env{"CGIHandle"}" method="post" class="Validate PreventMultipleSubmits">
            <input type="hidden" name="Action" value="AgentYourFrontendModule">
            <input type="hidden" name="Subaction" value="YourSubaction">
            <input type="hidden" name="AnotherField" value="test">

...
</form>
This basic form construct will cause that your post will arrive at http://www.yourotrsinstallation/otrs/in ... Field=test

In your related frontend module script, you can retrieve the request parameters by using the ParamObject:

Code: Select all

my @ParamNames = $Self->{ParamObject}->GetParamNames();
my $AnotherField = $Self->{ParamObject}->GetParam( Param => 'AnotherField' );
After that you can work with the data and setup the next dtl for instance.

Cheers, Marco
Post Reply