FieldName must not be null or undefined error on the screen after upgrading to Aviarc 3.6.0 from RC4 - aviarc

After upgrading to the Aviarc 3.6.0 we are getting the mentioned error on one of the screens.
The part of the screen which raises an error:
<custom:record-table bottom="40" width="100%" left="0" top="0" dataset="account-ds" class="list" name="accountlist-rc" >
<column width="0" display-field="AccountName" header="Accounts" field2="AccountCode" allow-sort="n" />
</custom:record-table>
Note that we customized the record-table widget to allow for 2 additional fields to be specified for each column (field2 and field3), so this is where field2 in the column comes from.

After investigating the changes done to allow for more than 1 field to be specified for each column of the record table were looking as follows (in the update method of the RecordTable.js, starting from line 670):
var field = this._datasetRow.getFieldObject(column.attributes['display-field']);
var field2 = this._datasetRow.getFieldObject(column.attributes['field2']);
var field3 = this._datasetRow.getFieldObject(column.attributes['field3']);
var text = field.getValue();
var text2 = field2.getValue();
var text3 = field3.getValue();
Since the column specification on the screen (code snippet in the question) does not set any value to field3 attribute the part
var field3 = this._datasetRow.getFieldObject(column.attributes['field3']);
was failing and throwing an error. Method getFieldObject always expects the value to be passed, even though it should probably be smart enough to cater for null/undefined values as well.
To solve the problem the code was refactored as follows:
var field = this._datasetRow.getFieldObject(column.attributes['display-field']);
var text = field.getValue();
if (column.attributes['field2'] != null) {
var field2 = this._datasetRow.getFieldObject(column.attributes['field2']);
var text2 = field2.getValue();
}
if (column.attributes['field3'] != null) {
var field3 = this._datasetRow.getFieldObject(column.attributes['field3']);
var text3 = field3.getValue();
}
After that the custom part of the widget code simply needs to cater for possible undefined values of text2 and text3 attributes.

Related

adobe acrobat XI pro javascript

i am calling an javascript function when out of focus on the form field. So what i am tying to do is the if i ticked required this field as required field it will have a red border around it, can i write a script to remove the required option when there are value inside the field?
var thisValue = this.getField("companyName").value;
var regexLetter = /[A-Z]+$/;
var Icon = "0"; //0 — Error (default) // 1 — Warning // 2 — Question // 3 — Status
var Type = "0"; //0 — OK (default) // 1 — OK, Cancel // 2 — Yes, No // 3 — Yes, No, Cancel
if (thisValue == ""){
app.alert({
cMsg:"this is an warning",
cTitle: "thsi is title",
nIcon: Icon,
nType: Type
})
} else if(!regexLetter.test(thisValue)){
app.alert('Type alphanumeric character');
}
This is going to be rather late, but this is how I do it in my documents:
var _companyName = this.getField("CompanyName");
_companyName.required = (_companyName.value === "");
You can also impose other dependencies, like:
var _companyName = this.getField("CompanyName"),
_companyLicense = this.getField("CompanyLicense");
_companyLicense = ((_companyLicense === "")
&& (_companyName !== ""));
Having your scripts split into a couple of files could help. I use a "shared" script which contains a vast majority of the logic and the a "specific" script to round of each individual document. Also, make sure when adding the scripts to just name them 1, 2, 3, etc. in the correct order or Acrobat will be stupid. Hope this helps you.

How to pre-select an option in a dropdown knockout js

I've looked at this other question, but can't get my select box to work correctly:
Binding initial/default value of dropdown (select) list
I've got the following Game object:
function Game(visitingTeamDetails, homeTeamDetails, game) {
if (arguments.length > 0) {
this.VisitingTeamDetails = visitingTeamDetails;
this.HomeTeamDetails = homeTeamDetails;
this.GameId = ko.observable(game.GameId);
this.HomeTeamName = ko.observable(game.HomeTeamName);
this.VisitingTeamName = ko.observable(game.VisitingTeamName);
this.SportTypeName = ko.observable(game.SportTypeName);
this.HomeAccountName = ko.observable(game.HomeAccountName);
this.VisitingAccountName = ko.observable(game.VisitingAccountName);
this.GameDateString = ko.observable(game.GameDateString);
this.GameTimeString = ko.observable(game.GameTimeString);
this.AvailableSportTypes = ko.observableArray(game.Sports);
this.sportTypeFunction = function () {
for (sportType in this.AvailableSportTypes()) {
if (this.AvailableSportTypes()[sportType].Name == this.SportTypeName()) {
return this.AvailableSportTypes()[sportType];
}
}
return null;
};
this.SportType = ko.observable(game.SportType);
}
}
SportType is an object with Name and SportTypeId.
I have the following template:
<td rowspan="3"><select data-bind="options: AvailableSportTypes, value: SportType, optionsText:'Name', optionsCaption: 'Choose...'" class="sportType"></select></td>
AvailableSportTypes is a list of SportType.
The list is coming in with the names of the SportTypes in the drop down list, but I can't make the initial selection be SportType. I wrote sportTypeFunction to show myself that the data was coming in correctly, and it would select the correct value, but changing my selection in the drop down would not update SportType.
I'm sure I'm doing something wrong. Anyone see it?
Thanks
When game.SportType gets passed in, it needs to be a reference to the an item in the game.AvailableSportTypes and not just an object that looks the same.
Basically two objects are not equal unless they are actually a reference to the same object.
var a = { name: "test" },
b = { name: "test" };
alert(a === b); //false
So, you would need to call your function to locate the correct object in the array and set it as the value of your observable.
Not that it is way better, but in KO 1.3 you can extend .fn of observables, observableArrays, and dependentObservables to add additional functionality.
Here is a sample: http://jsfiddle.net/rniemeyer/ZP79w

flex evaluating string for datagrid headerText

I am creating headerText for a datagrid (dgTop250). How do I get the variable headerStr to evaluate correctly in the last line of the function? With the code below I get the entire string as the column header in the datagrid, not the evaluated expression that I need. Variable colName is evaluating correctly. I tried creating an Object of headerStr and using Object.valueOf() in the last line, but got the same result as before.
public function get250(event:ResultEvent):void {
(var i:int = 0; i <= dgTop250.columnCount; i++) {
var colName:String=dgTop250.columns[i].dataField;
var headerStr:String="top250.lastResult.IMS001HQ2.SGM.getItemAt(i)."+colName+".label";
(dgTop250.columns[i] as DataGridColumn).headerText = headerStr;
}
}
As an example, this is what I'm getting as the header:
top250.lastResult.IMS001HQ2.SGM.getItemAt(i).STOCK.label
This is what I need:
Stock Number
"Stock Number" is the label for STOCK.
The correct answer is:
Change
var headerStr:String="top250.lastResult.IMS001HQ2.SGM.getItemAt(i)."+colName+".label";
to
var headerStr:String=top250.lastResult.IMS001HQ2.SGM.getItemAt(i)[colName].label;
Correct answer provided by Don Mitchinson.

Linq2XML missing element

How do I modify the query below to properly handle the case where the "Summary" element is missing from one of the articles? Now when that happens I get an "Object reference not set to an instance of an object."
var articles = from article in xmlDoc.Descendants("Article")
select new {
articleId = article.Attribute("ID").Value,
heading = article.Element("Heading").Value,
summary = article.Element("Summary").Value,
contents = article.Element("Contents").Value,
cats = from cat in article.Elements("Categories")
select new {
category = cat.Element("Category").Value
}
};
The problem is that article.Element("Summary") returns null if the element is not found, so you get a NullReferenceException when you try to get the Value property.
To solve this, note that XElement also has an explicit conversion to string. This won't throw if the XElement is null - you will just get a null string reference.
So to solve your problem you can change this:
summary = article.Element("Summary").Value,
to this:
summary = (string)article.Element("Summary")

Ext.JS Store Record is undefined

var debtProtectionId = 0
// get the selected id of debt protection dropdown
if (mainPanel.generalPanel.calculationsFieldSet.debtProtection.getValue() != '') {
debtProtectionId = mainPanel.generalPanel.calculationsFieldSet.debtProtection.getValue();
}
// get the store record with this id
var storeRecord = planCombinationsStore.getAt(debtProtectionId)
When I run the code it says 'storeRecord is undefined'.
What could be the cause of this?
Store.getAt expects an index to its internal collection. Do you mean Store.getById instead?

Resources