Hi All,
I am building a form via the solution model. Its a record view form.
Based on some data in a table (db) I need to populate a set of fields.
I have done the following,
var sSQL = "SELECT A, B FROM testTable";
var dsDataset = databaseManager.getDataSetByQuery('dbTest',sSQL,null,-1);
var dsdataSource = dsDataset.createDataSource('navigationDS',[JSColumn.TEXT, JSColumn.TEXT]);
var sForm = 'frm_test_form';
history.removeForm(sForm );
solutionModel.removeForm(sForm );
var jsform = solutionModel.newForm(sForm , dsdataSource, null, true, 510, 300);
jsform.view = JSForm.RECORD_VIEW;
jsform.styleName = 'testStyle';
jsform.scrollbars = SM_SCROLLBAR.HORIZONTAL_SCROLLBAR_NEVER;
jsform.navigator = SM_DEFAULTS.NONE;
I wanted to create a set of labels with the label to display the contents of column A. However this does not seem to work
aLabels[index] = jsform.newLabel('A', (2 + (index * 120)), 10, 110, 20);
So instead I switched to using text fields,
var aFields = new Array();
for (var index = 1; index <= dsDataset.getMaxRowIndex(); index++) {
var row = dsDataset.getRowAsArray(index);
aFields[index] = jsform.newField(row[0] , JSField.TEXT_FIELD, (2 + (index * 120)), 10, 110, 20);
aFields[index].editable = false;
aFields[index].name = row[0];
aFields[index].styleClass = 'button';
aFields[index].borderType = 'EmptyBorder, 0, 0, 0, 0';
}
I have two issues
- When I use ```
jsform.newField(‘A’] , JSField.TEXT_FIELD, (2 + (index * 120)), 10, 110, 20);
The values get set. But as expected, I get the same value for all the fields. When I use the array,
jsform.newField(row[0] , JSField.TEXT_FIELD, (2 + (index * 120)), 10, 110, 20);
I don't get any data. The array has data, but its not setting to the text field.
2) How can I set an onAction (which call a function) event to the text fields?