Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
FormApi and readonly fields
JvdW
Hi,
I have a template with a replicant field "Paragraph" which holds two fields: field1 and field2.
Both fields are selection boxes with two values: 1 or 2.
Using FormApi I want to make field2 readonly when field1 has value 1. This works fine when opening a new dcr using an init() function in my FormApi code.
But when I add a new Paragraph both fields field1 and field2 of this new paragraph will be editable. How can I add an eventhandler which fires when a new replicantfield is added?
All help is welcome.
JvdW
Find more posts tagged with
Comments
Jens
You can register all replicant instances in your init-function.
Like this:
function init() {
for(var i=1;i<100;i++){
IWEventRegistry.addItemHandler("/replicant_name["+i+"]/field_1", "onItemChange", handle_select);
}
}
....
I haven't found an other event that works on addInstance or something else yet. But it would be nice to have on. So if anybody know ....
Ciao,
Jens
bikerider
I have found that registering one of the input fields in my DCR as an event handler enables me to trigger an event when the user puts in data. For example, when the user enters a product name, my program determines the ordinality of the replicant, then does some stuff on the other fields in the replicant. This way you can add replicants and the event will fire.
IWEventRegistry.addItemHandler("/option_list/label", "onItemChange", onAddOptionDB);
...
function onAddOptionDB(item)
{
// Use a regular expression to extract this item's ordinality from its name.
var i = item.getName().match(/\d+/)[0];
var v_value = IWDatacapture.getItem("/option_list[" + i + "]/value");
....
do stuff in replicant
....
}