How do you workaround listboxes that are read only

Hi,

caught between a rock and a hardplace?

the fields are required…

  • make it readonly, it loses the data when attempting to save
  • make it disabled, it loses the data when attempting to save
  • make it hidden, it loses the data when attempting to save

doesn’t reach the _updating function, so unable to do anything
when saving, field validation kicks in : “Please enter required field - Deliver To”

does anyone have a workaround??

Js

  1. You need to tell how you set above. (Note that readonly attribute can only be used with textbox and textarea, not listbox or combobox. If you set as ReadOnly by server event or use the READONLY option, there is no effect.)
  2. Readonly attribute and input type=“hidden” values will be submitted by browser also. If you set it as Disabled by server event, value will not be submitted by browser. If the input does have value, and you have set it as hidden (with HIDDEN Edit Tag), value will be kept.
  3. Required field is not related to disable/readonly/hidden, if the value is empty, it won’t pass the “required” validation.

When you said “Listbox”, did you mean Combobox or SELECT control with Multiple option enabled under the Fields setup?

If so, then you should set Disabled property instead of ReadOnly to true in Page_Load server event that belongs to the Edit Page, for example:

$this->MyField->Disabled = true;

This will make the MyField field become disabled, and when you save that Edit form, then the values in that field still remains.

thanks for this,
but it looks like there are more inherent issues with disable/hiding fields and losing data with phpM.

this didn’t work. in particular with multi select field and, also on fields that are hidden shown based on a checkbox…
in view- startup code - have code to hide/show 2 fields depending on the value, looks like the hidden field loses its value when you look at the updating function. as well as a multi select field, when clicking save - returns “field required” when the field is set to ->disabled.

i can post the code if you’re interested.

Always post your code for discussion.