What are these parameters to the functions?

Login or register to post comments
4 replies [Last post]
Offline
Joined: 10/11/2010

Almost any and all functions which work on events launched by a Control click have these as the parameters:

$strFormId, $strControlId, $strParameter

Now, I can guess that ControlId is the ID generated as the flow of the page goes. I believe it is the c6_ctl and c6 in the following piece of code created by QC:

<div id="c6_ctl" style="display:inline;"><div id="c6">

FormId should be the name of the form, which I believe is what we pass as the agrument in the Run function of the QForm.

Now, what is this strParameter? Is it supposed to contain user-provided parameters? If yes, then how?

And if it not a variable to hold the user-provided parameters, what exactly is it and how to utilize it?

Regards,
Vaibhav

Offline
Joined: 04/22/2009

It is the action parameter of the control. You set it via

<?php
  $control
->ActionParameter = $something;
?>

Cheers

Helge

Offline
Joined: 10/11/2010

Thanks Helge,

Can you tell me what use is that of? May be I am being too dumb but, it would be of good help if you could explain that :|

Regards

jmirancid's picture
Offline
Joined: 04/04/2011

Hi Vaibhav, for example you want to store an id field value in that control.

Typically I use it in QDatagrid's, when create a column with a control and I want to perform some action on the control refers to the row, but... how I pass the value of the current row?

Well when create the control I complete added the following code...

<?php
$Control
->ActionParamter = $Person->Id;

// Person is the object binded on the Row.
?>

And the in the Event Handler I use it...

<?php
$PersonId
= cint($strParameter);

$PersonManager->Delete($PersonId);
?>

Just remember, the ActionParameter is a string value and only you can pass just one parameter. If you need pass more surely need to parse the string to get values, something like this...

<?php
$Control
->ActionParameter = 'Jhon,Foo,28';
?>

and then get it...

<?php
$Parameter
[] = split($strParamter,',');

echo
$Parameter[0]; //John
echo $Parameter[1]; //Foo
echo $Parameter[2]; //28
?>

Hope It's Help you.

Regards, JMI

Offline
Joined: 10/11/2010

Thanks a lot for that great help. I just wanted to know what exactly would be the use of that parameter and you have helped me so much by explaining it :)

Thanks again.

Regards,
Vaibhav