Prepopulate filter of add page

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

Re: Prepopulate filter of add page

Post by marcoqui »

How could i save and reuse some field from an add page to another?

I need to prepopulate some filter fields on the add form maintining the same filter values of the previously added form (i redirect the page after add to a new add page).

The prepopulated fields could be changed by the user (they refer to dropdown menu).

In add page ,i have 3 filters that could change (selected from a dopdown ) and a series of field to copile .

After i save i need to be redirectet to another add page (of the same table) maintining the tree filters already selected .

I have selected to redirect to add page after save but i cannot find how to prepopulate the tree filters with the same values of the old add page.

i think i need to save the formValues of the filters on saving and recall the values as default for the new page .


mobhar
User
Posts: 11741

Post by mobhar »

Explain about "and a series of field to copile". What does it mean?


danielc
User
Posts: 1601

Post by danielc »

The simplest way is to use copy feature. After add, redirect to the new add page in Page_Redirecting server event:
if ($this->IsInsert()) {
$url = "<table>add.php?id=" . $_SESSION["newid"]; // replace <table> with your table name
}

Get newid in Row_Inserted server event (if your id field is auto increment field):
$_SESSION["newid"] = $rsnew["id"];


marcoqui
User
Posts: 4

Post by marcoqui »

Hi i think i have found my solution.

I capture past inserted values with $_SESSION["myvalue"] in Row Inserted

I set in field setup $_SESSION["myvalue"] as default value .

After compiling my field saving and redirecting to a new add page my filter fields are already populated and i could change them if i need .

thanks for the support.


Post Reply