URL parameter "fill" for confirm page and cancel page

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
totza2010
User
Posts: 109

URL parameter "fill" for confirm page and cancel page

Post 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&amp;fk_TestID=01HTPQGJ619YZ3D7TT6PMRJ1EH&amp;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.


arbei
User
Posts: 9390

Post by arbei »

There is no such URL parameter as "fill", you need to handle the URL parameter yourself.


totza2010
User
Posts: 109

Post 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>";

arbei
User
Posts: 9390

Post 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.


mobhar
User
Posts: 11732

Post 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
    }
} 

totza2010
User
Posts: 109

Post 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.


arbei
User
Posts: 9390

Post by arbei »

You may find out where is the URL for HTTP POST/GET first.


Post Reply