[rt-users] How to add a new form page

Luca Mazzaferro luca.mazzaferro at gmail.com
Tue Sep 16 04:06:32 EDT 2014


Hi to All,
I found the solution... even if I don't understand why.
With "GET" method it works properly...
If anyone has an explanation will be really appreciated.
Thank you for your help and interest.
Cheers.

    Luca M.


2014-09-16 9:22 GMT+02:00 Luca Mazzaferro <luca.mazzaferro at gmail.com>:

> Hi Alex,
> maybe we are focusing on the wrong point.
>
> The problem can be reduced to this:
> How can I pass data from a full customized html form to a perl script to
> handle them in some way (store into DB, print on web etc etc) everything
> inside the RT environment.
>
> It is simple to do it in a classic apache environment, but inside the RT
> it doesn't work properly.
>
> To be more specific:
> This is part of the code inside the form called NewsForm.html:
>
> <div id="container">
>  <div class="titlebox-title">
>    <span class="left"> Add News </span>
>  </div>
>
> <form id="newsform" method="post" action="FillDB">
>   Name : <input type="text" name="name"><br>
>   Expiration Date : <input type="text" name="expdate"><br>
>   Weight: <input type="text" name="weight"><br>
>   Subject: <input type="text" name="subject"><br>
>   Text: <input type="text" name="text"><br>
> <input type="submit" value="Submit">
>
> </form>
>
>
> and this is the FillDB in the same directory.
>
> <%INIT>
>
> use strict;
> use warnings;
> use DBI;
> use CGI;
> use CGI::Carp;
>
> my $info = CGI->new();
> my $name = $info->param('name');
> print "Hello $name";
> </%INIT>
>
> Very simple as you can see.
> It works ONLY after I restarted and cleaned the RT cache and ONLY IF I
> don't refresh the NewsForm.html.
> In all the other case the form seems to do not be able to pass the
> variable values
>
> Thank you
> Cheers.
>
>     Luca M.
>
>
>
> 2014-09-16 2:56 GMT+02:00 Alex Peters <alex at peters.net>:
>
>> I am finding it difficult to fully understand your problem so far.
>>
>> You want custom information shown on the login page.  You are currently
>> using jQuery and a custom Perl script.  Have you considered making a local
>> copy of the LoginHelp template and modifying that instead?  Is the custom
>> information on the login page dynamic or static?
>>
>> You want the custom form to only be visible after a user logs into RT,
>> presumably for authentication purposes.  Is this correct?
>>
>> You mention an SQLite database.  Is this RT's database or a separate
>> one?  If separate, exactly what information does it hold, and is the custom
>> form meant to be writing to both databases?
>> On 16/09/2014 6:50 am, "Luca Mazzaferro" <luca.mazzaferro at gmail.com>
>> wrote:
>>
>>> Hi Albert,
>>>
>>>> > Now I need to populate the sqlite database and it should be simple
>>>> with perl
>>>> > but something is not working properly: I'm not able to pass the
>>>> variables
>>>> > values from the form to the perl script. It seems the RT overwrites
>>>> them with
>>>> > null values.
>>>> > Can I do it in another way?
>>>>
>>>> Here I don't understand...what sqlite database ? I can understand you
>>>> want
>>>> to retrieve data from a sqlite database to show some information but why
>>>> you want to populate the sqlite database ?
>>>
>>>
>>> The sqlite database should be filled with the information provided by
>>> the admin and I would that this operation is performed inside the RT web
>>> interface, after the login.
>>> For this purpose I already modified the menu and created a classical
>>> form page with "post" method.
>>> The form is sent to as simple as possible perl script which in this
>>> moment only prints the values on the web (in future it should fill the
>>> database).
>>> The problem happens when I submit the form: it works ONLY and ONLY if I
>>> restart the RT, clean the RT cache AND I don't refresh the form page. In
>>> all the other case it seems it is not able to pass the values of the form.
>>> It doesn't answer with error it simple doesn't pass the values.
>>> It is a very strange behaviour and it is not related with any kind of
>>> database.
>>> Is it possible that RT overwrites the values for some reason?
>>>
>>>
>>>>
>>>> > CustomField could be useful also for this task?
>>>>
>>>> I'm not sure my answer is any help for you. The CustomField allow you to
>>>> create some...custom field use by ticket. For example if you allow you
>>>> user
>>>> to create ticket through the SeflService you maybe want then to tell
>>>> you if
>>>> the ticket is urgent or not. For that kind of information you can use
>>>> Custom Field.
>>>>
>>>
>>> Unfortunately I don't think this is useful in my case.
>>> Thank you again.
>>> Regards.
>>>
>>>      Luca M.
>>>
>>>
>>>> Don't forget RT have a REST API so you can use that to do some
>>>> interaction
>>>> between you script and RT.
>>>>
>>>> Regards.
>>>>
>>>> JAS
>>>>
>>>> --
>>>> Albert SHIH
>>>> DIO bâtiment 15
>>>> Observatoire de Paris
>>>> 5 Place Jules Janssen
>>>> 92195 Meudon Cedex
>>>> France
>>>> Téléphone : +33 1 45 07 76 26/+33 6 86 69 95 71
>>>> xmpp: jas at obspm.fr
>>>> Heure local/Local time:
>>>> lun 15 sep 2014 22:15:41 CEST
>>>>
>>>
>>>
>>> --
>>> RT Training - Boston, September 9-10
>>> http://bestpractical.com/training
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20140916/6bd17d92/attachment.htm>


More information about the rt-users mailing list