Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Prefill form using GET

edited November 2017 in Mods and Customizations
I am attempting to have form pre-filled when creating new tickets. There are about 4 parameters that are passed via URL.

I have been able to pre-select the topic by setting the variable topicId . However, I cannot understand how to then pre-fill the fields.

This is my current attempt. As you can see I imagine that something needs to be done within those foreach loops, but not sure what.

$_GET['topicId'] = '10'; // this needs to be set to QA reporting all the time
$pat_id = $_GET['pat_id'];
$user_id = $_GET['user_id'];
$study_date = $_GET['study_data'];
$frame_number = $_GET['frame_number'];

foreach ($form->getFields() as $field) {
foreach ($field as $f) {




  • Solved it!
  • What was your solution?  It might help other people looking to do the same thing.
  • @haris1 can you update us one your solution?
  • I created a new 'api' page with this code

    if(!is_object($thisclient) || !$thisclient->isValid()) die('Access denied'); //Double check again.

    if ($thisclient->isGuest())
        $_REQUEST['id'] = $thisclient->getTicketId();


    I edited the login code from include/client/

            <input id="username" placeholder="<?php echo __('Email or Username'); ?>" type="text" name="luser" size="30" value="<?php echo $_GET['user_id']; ?>" class="nowarn">

    And finally added these lines in include/client/templates/dynamic-form.tmpl.php (Asterix to anonymise company name):

                if ($_GET['****'] == '1')
                    switch ($field->getLocal('label'))
                        case 'Patient ID':

                        case 'Exam Date':

                        case 'Slice/Frame Number':

Sign In or Register to comment.