Page 2 of 2

Re: User defined buttons

Posted: Thu Jan 18, 2018 9:36 am
by Fakiro82

Hi,
if i want to pass more value in url, how can i do this?

I try to write code:

if ($this->getCurrentMasterTable() != "") { // make sure the detail list page is being displayed when it contains the master table (Master/Detail List page)
$options = &$this->OtherOptions;
$option = $options["action"];
$item = &$option->Add("mybutton"); 
$ordineFattura = urlencode($this->OrderId->CurrentValue);
$CodiceOggetto = urlencode($this->ItemCode->CurrentValue);
$DescrizioneOggetto = urlencode($this->Description->CurrentValue);
$Quantita = urlencode($this->Quantity->CurrentValue);
$Prezzo = urlencode($this->Price->CurrentValue);
$Totale = urlencode($this->NetTotal->CurrentValue);
$item->Body = "<a class=\"ewAction\" href=\"Fattura.php?OrderId=".$ordineFattura. "&ItemCode=".$CodiceOggetto. "&Description=".$DescrizioneOggetto. "&Quantity=".$Quantita. "&Price=".$Prezzo. "&NetTotal=".$Totale. "\">Genera Fattura 2</a>";

}
}

but not work.

Thank you much,
Andrea.


Re: User defined buttons

Posted: Fri Jan 19, 2018 4:14 pm
by mobhar

Fakiro82 wrote:
but not work.

Please always explain it in more detail. What did you mean "not work"? Did you enable the Debug mode from "Tools" -> "Advanced Settings", and did you see any error message?


Re: User defined buttons

Posted: Mon Jan 22, 2018 3:18 am
by Fakiro82

Sorry for my explain.

I need to pass more than 1 value in url to create Invoice document. The tables are ORDER_TABLE and DETAILS_TABLE. ORDER TABLE is join with DETAILS_TABLE.
In my case, I need to pass value to insert in invoice document. Now if I pass the Inovoice OrderID $ordineFattura = urlencode($this->OrderId->CurrentValue); this work because this value is in Master Table (if (this->getCurrentMasterTable() != ""). But, if I try to pass the other value (belong DETAILS_TABLE), like $DescrizioneOggetto = urlencode($this->Description->CurrentValue); this not work because is in Detail Table.

I ask to you if you know a method to do this or also the other method to pass value in other page (invoice.php) without write values in Url (when I pass value in URL, this value are visibile and this is not good). Do you know other method? Or Do you know like encrypt url?

Andrea.


Re: User defined buttons

Posted: Mon Jan 22, 2018 4:40 am
by sangnandar

Fakiro82 wrote:
But, if I try to pass the other value (belong DETAILS_TABLE), like $DescrizioneOggetto
= urlencode($this->Description->CurrentValue); this not work because is in Detail
Table.

If you are in master/detail mode, it means: you are actually in List Page of the detail table.
Now, in List Page there are records (with s), hence calling
$this->Description->CurrentValue;
with
$options = &$this->OtherOptions;
is a wrongdoing because, well...which value? there are many (records).
Either it will be empty or call an error.

The solution would be to move your button within the row, that is calling
$this->Description->CurrentValue;
with
$opt = &$this->ListOptions;

You can refer to ListOptions_Load() and ListOptions_Rendered() server events in the help file to find more examples.


Re: User defined buttons

Posted: Tue Jan 30, 2018 7:55 am
by Fakiro82

Hi sangnandar,
sorry but i don't undestand how to do this.
What do you mean move your button within the row?

Thank you so much,
Andrea.


Re: User defined buttons

Posted: Tue Jan 30, 2018 9:33 am
by mobhar

Fakiro82 wrote:
the other method to pass value in other page (invoice.php) without write values in
Url

Then try to use "Session Variable". Google "php session variable".


Re: User defined buttons

Posted: Mon Jul 15, 2019 5:17 pm
by emezty

how about adding button per row? and update another table (e.g add to cart)
Thanks in advance


Re: User defined buttons

Posted: Wed Jul 17, 2019 9:50 am
by mobhar

You may simply use "ListOptions_Load" and "ListOptions_Rendered" server events. Please read "Server Events and Client Scripts" topic from PHPMaker Help menu for more info and example.