The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Customise List of Returned Subnissions

As you know, when a client-user clicks 'View' against a form on their Forms menu, a list of submissions is presented. This list can then be customised by use of the Search box whereby a field and a value for that field can be used to filter the list.

What I want to do is to automatically add a filter (on one column) to the list as it is presented (it will always be the same column-name for every form). I am guessing this should be quite easy to do programmatically?

I have looked in clients/forms/index.php and I see a

$forms = ft_search_forms($account_id, false, $search_criteria);

but where do I find the source for ft_search_forms please?

Ah… I have found a hook instead in the hooks manager:

ft_search_submissions, end

just got to figure out how I grab the results, add my 'auto-filter' and substitute the filtered results?

There is an override variable, $return_hash. Does this 'send' a list of the submissions to be displayed to the template?

I did an implode() on this but all I got was the bland "Array" in the 1st element … so I guess it's an array within an array? If that's the case does it contain all the submissions records?

Any help to sped this up appreciated… I hate PHP arrays :o)

Ah... I have sussed this ... $hash_return is a multidimensional array containing returned submission records.. Once I've written my hook to manipulate it I will post the code.....
Fantastic! Thanks!


OK … this seems to work for me…

Loop around the $return_hash array in the ft_search_submissions, end hook and remove whatever elements take your fancy!

As this is a multi-dimensional, associative array, my brain went into a loop of its own trying to code it… but try this… (p.s. don't forget to reduce the counters in $return_hash!)
$delete_count = 0;

foreach ($return_hash['search_rows'] as $index => $data) {
   if ($data['account_id'] <> $acc_id ) {   <= substitute your test here
      $delete_count = $delete_count + 1;

$return_hash['search_num_results'] = ($return_hash['search_num_results'] - $delete_count);
$return_hash['view_num_results'] = ($return_hash['view_num_results'] - $delete_count);

HTHs someone!

Forum Jump:

Users browsing this thread: 1 Guest(s)