Page 1 of 1
URL parameter "fill" for confirm page and cancel page
Posted: Mon Apr 08, 2024 1:23 am
by totza2010
when i create custom url by fill
<a class="btn btn-default ew-add-edit ew-add" data-bs-toggle="tooltip" data-table="test_items" data-caption="เพิ่ม->ทดสอบใหม่" data-ew-action="modal" data-action="add" data-ajax="false" data-url="/TestItemsAdd?showmaster=test&fk_TestID=01HTPQGJ619YZ3D7TT6PMRJ1EH&fill=(`StockStatus` in (1,2))" data-btn="AddBtn" data-bs-original-title="เพิ่ม->ทดสอบใหม่">
<span class="badge text-bg-warning">5</span>
</a>
and when click to open modal i get param("fill") to use, then click submit to confirm page, and then click cancel button to backward first page param("fill") not work.
Re: Url param
Posted: Mon Apr 08, 2024 10:24 am
by arbei
There is no such URL parameter as "fill", you need to handle the URL parameter yourself.
Re: URL parameter "fill" for Master/Detail-Add page
Posted: Mon Apr 08, 2024 1:00 pm
by totza2010
yes, i handle the URL parameter myself, it work when add page but when in confirm page and cancel page (after confirm page) url not contain add page,
$itemOption = &$option->add("add_$itemName");
$addCaption = HtmlTitle(Language()->phrase("AddLink")) . "->" . Language()->TablePhrase("outbound_item_" . $itemName, "TblCaption");
$fill = $where[$key];
$Url = HtmlEncode(GetUrl($this->AddUrl)) . "&fill=" . $fill . (!in_array($itemName, array("borrow", "sell")) ? " AND StockCompany = '" . $CompanyID . "'" : "") . "&outbound_type=" . $Status[$itemName];
$UseAjaxActions = $this->UseAjaxActions ? 'true' : 'false';
$itemOption->Body = "
<a class=\"ew-add-edit ew-add\" title=\"{$addCaption}\" data-bs-toggle=\"tooltip\" data-table=\"test_items\" data-caption=\"{$addCaption}\" data-ew-action=\"modal\" data-action=\"add\" data-ajax=\"{$UseAjaxActions}\" data-url=\"{$Url}\" data-btn=\"AddBtn\">
<span class=\"badge text-bg-warning\"><i class=\"fa-solid fa-plus\"></i></span>
</a>";
Re: URL parameter "fill" for confirm page and cancel page
Posted: Mon Apr 08, 2024 1:16 pm
by arbei
Confirm page posts back the page by HTTP POST. Cancel page reloads the page by HTTP GET. In both cases you need to add your own URL parameters to the URL for HTTP POST/GET yourself.
Re: URL parameter "fill" for confirm page and cancel page
Posted: Mon Apr 08, 2024 2:12 pm
by mobhar
The closest approach for this is by using Custom Field, then you may handle the certain parameter that you supplied from that Custom Field via server event, for example, Row_Rendered:
if (CurrentPageID() == "add") { // if current page is add page
if ($this->CurrentAction != "confirm") { // if the page is NOT a confirmation page
// ...
}
if ($this->CurrentAction == "confirm") { // if the page is a confirmation page
// change YourField to your actual field name
$this->YourField->ViewValue = $this->YourField->CurrentValue; // display the view value from current value
}
}
Re: URL parameter "fill" for confirm page and cancel page
Posted: Mon Apr 08, 2024 3:28 pm
by totza2010
arbei wrote:
Confirm page posts back the page by HTTP POST. Cancel page reloads the page by HTTP GET. In both cases you need to add your own URL parameters to the URL for HTTP POST/GET yourself.
how set url for HTTP POST/GET? please exam.
Re: URL parameter "fill" for confirm page and cancel page
Posted: Mon Apr 08, 2024 7:52 pm
by arbei
You may find out where is the URL for HTTP POST/GET first.