Page 1 of 1

Filter selection affects the field selection when adding or editing (v2023)

Posted: Mon Oct 16, 2023 11:31 pm
by Wolf

PHPMaker 2023/2024
the filter selection affects the field selection when adding or editing.
int field with selection 1 - One, 2 - Two
if in list Page Filter column is not checked all working good.
if in list Page Filter column is checked
then i add field is select 1 - One also in edit page.


Re: Filter selection affects the field selection when adding or editing (v2023)

Posted: Tue Oct 17, 2023 7:15 am
by motfs

Is the field set up as User Values or Use Lookup Table? Show your table and field schema and field settings so that other can simulate the issue you mentioned.


Re: Filter selection affects the field selection when adding or editing (v2023)

Posted: Wed Oct 18, 2023 2:33 pm
by Wolf

mysql:
test_field int DEFAULT NULL

phpmaker:
fields
on field select Filter

Edit tag - Select
User Values
1 | First
2 | Second

when I click the add or edit button, “First” is already selected in the field


Re: Filter selection affects the field selection when adding or editing (v2023)

Posted: Sun Feb 11, 2024 6:26 pm
by mobhar

Did you use Checkbox or Radio Button control?


Re: Filter selection affects the field selection when adding or editing (v2023)

Posted: Sun Feb 11, 2024 6:36 pm
by Wolf

No only Select


Re: Filter selection affects the field selection when adding or editing (v2023)

Posted: Mon Feb 12, 2024 12:20 pm
by mobhar

If you want to keep Filter option is enabled under Fields setup -> List column, and you don't want option 1 is selected when Add page is loaded, then you may simply put this following code in Startup Script under Add Page:

$("#x_test_field").val(""); // initial value always blank

Re: Filter selection affects the field selection when adding or editing (v2023)

Posted: Tue Feb 13, 2024 12:51 am
by Wolf

Okay, on the add page we get an empty field. This is good.
But if we click "Edit" on the row with a blank field, we get option 1.
ok, let’s add our script to Startup Script under “Edit Page”.
We got: if we edit a row with an empty field - good
if we edit a row with field 1, 2 or 3 selected - we will get an empty field - not good


Re: Filter selection affects the field selection when adding or editing (v2023)

Posted: Wed Feb 14, 2024 5:57 pm
by mobhar

You should only implement it in Add Page, not in Edit Page, because in Edit Page, you have already had the current data for that field.


Re: Filter selection affects the field selection when adding or editing (v2023)

Posted: Wed Feb 14, 2024 6:40 pm
by mobhar

If in your Edit Page there is no data yet for that field, and you want to add that code, then you need to check whether the field is not empty or not. If empty, then implement that logic.


Re: Filter selection affects the field selection when adding or editing (v2023)

Posted: Thu Mar 07, 2024 12:40 am
by Wolf

Fixed in 2024.9