Parameters in URL

Hi…

In version 2020, i use URL to open add screen whith data in fields:
http domain.com.br/ativos/fluxoadd.php?cv=C&ativo=VALE3&qnt=10&unit=57.83&valor=617.00

How to in version 2021 ?
I try whithout spaces:
http domain.com.br/ativos/fluxoadd ? cv=C&ativo=VALE3&qnt=10&unit=57.83&valor=617.00
http domain.com.br/ativos/fluxoadd $ cv=C&ativo=VALE3&qnt=10&unit=57.83&valor=617.00

There is no “.php” in a route. Read Migrating to v2021: https://phpmaker.dev/doc/migrate2021.htm, see the “Routing” section:

If you have any code that specifies a URL (e.g. pageRedirecting server event), you need to update it. In general, simply remove “.php” and the parameter names for the primary key fields, and separate them by “/”, e.g. change carsview.php?ID=1&foo=bar to carsview/1?foo=bar.

So you should change:

/ativos/fluxoadd.php?cv=C&ativo=VALE3&qnt=10&unit=57.83&valor=617.00

to

/ativos/fluxoadd?cv=C&ativo=VALE3&qnt=10&unit=57.83&valor=617.00

Note that the values will not be used to fill the field value, you might have a server event to do that yourself in your old project. Make sure your code is still there.

Thanks for yor answer again.

in View page, when pass Primary key… WORKS !!!
/ativos/fluxoadd/33 View page whith registry 33 data. Good.

I see url when pass filter or other parametrs in list page… all works fine.

But… In EditPage or AddPage not work… I Try many times:

/ativos/fluxoadd?cv=C&ativo=VALE3&qnt=10&unit=57.83&valor=617.00
/ativos/fluxoadd/?cv=C&ativo=VALE3&qnt=10&unit=57.83&valor=617.00
/ativos/fluxoadd/cv=C&ativo=VALE3&qnt=10&unit=57.83&valor=617.00

I need send data to add page in URL,
because when user click in other Grid page, a need send to add just set qnt… and save
this grid have a line with all others fields i use in ADDpage.

Have other mode to make this in PHPMaker 2021 ?
Send data to fields when add page ?

( 2020 all works fine - I now… SLIM now.)

You need to handle the param values from URL by using “Row_Rendered” server event. You may use Get() function to get the values from URL.

kaldiris wrote:

/ativos/fluxoadd/33 View page whith registry 33 data. Good.

That is COPYing the record with primary key = 33, so there are values from the existing record.

arbei wrote:

Note that the values (in the URL) will not be used to fill the field value, you might have a server event to do that yourself in your old project. Make sure your code is still there.

As mobhar wrote:

You need to handle the param values from URL by using “Row_Rendered” server event. You may use Get() function to get the values from URL.

YESSSSS - WORK NOW !

public function rowRendered()
{
// To view properties of field class, use:
//var_dump($this->);

if(isset($_GET[‘link’]) && !empty($_GET[‘link’])){
$this->Link->EditValue = htmlspecialchars($_GET[“link”]);
}
if(isset($_GET[‘desc’]) && !empty($_GET[‘desc’])){
$this->Descricao->EditValue = htmlspecialchars($_GET[“desc”]);
}
}

Thank you very much for the tip and the great help.

You may simply use Get() function to get the param values from URL. See this global function from the generated “phpfn.php” script file.