How do I make a field which appears on MULTIPLE sections of a form be "read only" everywhere in given circumstances ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2010 04:25 AM
Hi, Help please ! I am at a loss here.
I have a bespoke form with many sections. For info, the sections are made visible based upon progression through a list of status values. No problem with that - it works fine.
One field (e.g. "Customer PO Number") has to appear on more than one section, and when status changes (e.g. to "Order Received") that field must become "read only" on which ever section it appears in.
Alas I can't get all occurrences of the field to become "read only".
I have endeavoured to control this initially by a UI Policy and then a simple Client Script using g_form.setReadonly(...)
Both approaches result in the 1st occurrence of the field (reading through the tabs from left to right) being "read only" when required with the 2nd occurrence being "editable" on all occasions
What confuses me even more is the fact that if the record is at "Order Received", the 1st occurrence of "Customer PO Number" is read only; the 2nd occurrence is "editable", but changing the value of the 2nd occurrence and then Saving the record looses the revised change (which is perhaps not a bad thing).
What I really need is for both occurrences of the field to show the same behaviour - i.e. be truly read only when at "Order Received" or beyond.
Hope that makes sense and thanks in anticipation .... John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2010 05:30 AM
You could try doing in via Access Control Rules, as you can have those run on a condition.
re the UI policies, client scripts, I don't think the system was ever built to expect to see the same field twice on the same form unfortunately.
We only expect to see the field once on the form but an ACL might make all occurences read-only for you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2010 11:02 PM
Thanks - I'll give it a try.
Appreciate your response ... regards .. John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2015 02:49 AM
If this is a catalog item, I would look at using a variable in each section and making that variable visible / read only as needed
so the variable you want to use is u_customer_po
you create variables called uv_customer_po_1; uv_customer_po_2, etc - one in each section
your UI policies hide u_customer_po and work on the uv_customer_po fields
If the u_customer_po field is to be used to determine if a section is shown or not, then create a script in onLoad that is used to calculate which of the uv_customer_po fields' is meant to be copied to u_customer_po.
You then need to create an onChange script for each of the uv_customer_po fields
If u_customer_po is not used to determine any sections being shown, just add it as an onSubmit script and let it calculate at the end
onLoad script
function updateCustomerPO()
{
if (x==7 and b=1)
current.variables.u_customer_po == current.variables.uv_customer_po_1;
else if (x==8 and b=1)
current.variables.u_customer_po == current.variables.uv_customer_po_2;
else
current.variables.u_customer_po == current.variables.uv_customer_po_3;
}
onChange script for each uv_customer_po variable
updateCustomerPO();
onSubmit script
updateCustomerPO();
Cheers