The basic issue is that your DCT is blank for that dropdown. So on form init, you need to another callserver to read the data again, while passing it the selected item, and populating the dropdown with the correct data, marking the proper item selected so that it is saved correctly.Another approach, if your list is not too dynamic, is to, when you build the dropdown in the 1st place, populate a 2nd hidden dropdown (and select all items on save). This saves all the items in the DCR. On the next form init, you can read the items in the items int he 2nd dropdown and populate the 1st. Of course if the list changed since last save, it will not be updated, hence my caveat.
Even if i used a callserver for every replicant added i still need to create a new array in my populatedata function but i dont know how many replicant i will have ??any ideas or just a snib of code would reallllllllllllllllly be appreciated it
Thanks Andy , actually this is what i have done. i am in the process of trying to write a code to recreate the array for every replicant according to the value selected. wish me luck
In addition to the new replicants you'll need to build it for each existing replicant just as well upon init. To make it more interesting, for those you have to replicate saved selections.How *Dynamic* is your drop-down? The easiest way to create DCR drop-downs dynamically is to create them in the DCT, before any DCRis opened. If your changes depend for example on the Category/Type, you should probably use DCT Inline Command. Is there any particular reason why you can't?
if ($values){ my $boolean = true; foreach $value($values){ my $isDefaultSelected = ( ! $OptionSelected && $boolean ) || $value eq $OptionSelected ? "true" : "false"; $arrayOptions .= "dropdown_$array_counter\[" . $counter++ . "\] = new Option('$labels','$values', $isDefaultSelected, $isDefaultSelected );\n"; $boolean = undef; }
if you can help me out in converting this code from perl to Javascript...
//--------------------------------------------------------------------------------------// FormAPI (Client Side)//--------------------------------------------------------------------------------------var all_options = new Array;...add_option(optLabel, optValue, optSelected) { all_options[all_options.length] = new Option(optLabel, optValue, optSelected, false);}#---------------------------------------------------------------------------------------# Server Side#---------------------------------------------------------------------------------------use strict;$| = 1; #forces a flush after every write or print, Optionalprint "Content-type: text/html\n\n";my %options;# Build %options Hash with Labels, Values and whatnotmy $calls = '';$calls .= qq(api.add_option\('$_', '$options{$_}', false\);\n) foreach(keys %options);build_call_back($calls);exit 0;#------------------------------------------------------------------------------------sub build_call_back { my ($options) = @_; print <<END_PAGE;<html><head><script type="text/javascript" language="javascript"> api = parent.getScriptFrame(); if (api) {$options}</script></head><body></body></html>END_PAGE}
var metaTagChildren = IWDatacapture.getItem("/meta_tag").getChildren(); for(j=0; j < metaTagChildren.length; j++){ var metatagItemName = metaTagChildren .getChildByName("meta_tag_id"); if(metatagItemName.getOptions() != "") { metatagItemValue = metatagItemName.getOptions()[metatagItemName.getValue()].value; metatagItemName.setOptions(fourth_ddm); localarray = setOptionSelected_in_array(metatagItemName,metatagItemValue); } }
for(i=0; i< fourth_ddm.length; i++){alert ("entry "+i+" is "+fourth_ddm(i,1))
Your code is pretty confusing, the setOptions(fourth_ddm) is what does the populating of the list, but I do not see where it is being built. I suspect if you ran something like this: for(i=0; i< fourth_ddm.length; i++){alert ("entry "+i+" is "+fourth_ddm(i,1)) You would only see 1 alert. This should be a list of all options to be populated.