com_chronoforms [chronoform] => singleResult [sid] => WM2011 [Itemid] => 136 [view] => category [layout] => blog [id] => 10)Could anybody be so kind and help me how I have to manage to get that variable working? Thanks in advance.Herbert"> How to open a form by direct link? - Forums

Forums

How to open a form by direct link?

HerKle 28 Feb, 2012
Hi everybody,

I created a multi record loader form to display a list of results, from which each result shall open a single record loader form to display further details of that result. To achieve this I used a custom code module in the first multi loader, creating a link like this:
index.php?option=com_chronoforms&chronoform=singleResult&sid=".$searchParam."

The variable $searchParam is a field result of the first query.

I tried all possible combinations of "Session to data" "Data to session" in both forms but that variable never showed up in the next form, nor could the debugger indicate where it got lost. It always showed on the debugger's list:
Array
(
    [option] => com_chronoforms
    [chronoform] => singleResult
    [sid] => WM2011
    [Itemid] => 136
    [view] => category
    [layout] => blog
    [id] => 10
)


Could anybody be so kind and help me how I have to manage to get that variable working? Thanks in advance.

Herbert
GreyHead 29 Feb, 2012
Hi HerKle,

I'm lost - if the value of sid is showing in the Debugger on the second form then it is there and available? What exactly is the problem?

Bob
HerKle 29 Feb, 2012
My mistake. I tried to use the variable as $sid.

Later found out the following:


<?php
// check correct length of variable
$_GET['sid']=substr(trim($_GET['sid']),0,6);
// check correct spelling of variable and in case of failure display default value
if(substr($_GET['sid'],0,2)!='WM'||!is_numeric(substr($_GET['sid'],2,4))) $_GET['sid']='WM'.((date('Y'))-1);
// include variable into form array
$form->data['sid']=$_GET['sid'];
?>


That did it. Sorry for bothering you.
Thanks for the help.
GreyHead 29 Feb, 2012
Hi HerKle ,

That code shouldn't be necessary, ChronoForms automatically parses the URL and adds any variables into the $form->data array for you.

Bob
HerKle 29 Feb, 2012
That might be. But since it's a get-variable I like to have it validated before processing ;-)
This topic is locked and no more replies can be posted.