Progress-4GL: How to dynamically add a fill-in in a form and take user input in it? - openedge

I've a form in a base QAD mfg/pro (ver 10.2) program. I know the names of form, frame and fields. I'dont have access to base program's code modification. I've a wrapper program that access various fields from the existing form using handles, first-child, next-sibling etc.
What I want to do is to add a fill-in into this form/frame from the wrapper program and during runtime, take user input into that field.
I've been able to create text (for label) and fill-in field (called user) in the frame, however, the field is in't enabled.
create fill-in txt_user
assign
name = "txt_user"
row = 7
column = 19
frame = hWidget
visible = true
side-label-handle = lbl_user.
How can I enable the fill-in field txt_user and take input in it?

To Enable the field set the SENSITIVE property to TRUE. To query the current value, read the INPUT-VALUE property.

Related

In a PDF, How to auto populate one field using other field text?

I have a 54 pages PDF file. In this PDF, I have some fields like Full Name, the Phone number, etc that repeats more than 10 times. How can do like When I enter Full name one time and all of the remaining full name fields can be filled automatically using Adobe Acrobat?
I hope I asked my question clearly. Thank you for your time and help.
The easiest is, when all properties of the field (font type, size, color, etc.) are the same, to simply copy the field to the other pages.
The field value is a so-called field level property, which will be the same for all instances of the field.
If you want to have only one place where the value can be entered, and the dependent fields should be read-only, you would have to have a different name for the entry field and display fields. In the entry field, you would then add the following line of code in either the Format or onBlur event:
this.getField("myDisplayFields").value = event.value ;
And that should push the value from the entry field to all fields named myDisplayFields.
And that's it…

Return value of another field within model

I have a model with two fields, Name and Token. In my app, the user will select a record from a Dropdown populated with the Name field of all records. When this happens, I need to assign the record's corresponding Token value to a variable in a server script, but am not sure how to accomplish this.
There are two options that are suitable. As a first option you could implement a server script that returns the token of the field when you edit the widget.
function checkToken(widgetValue) {
var query = app.models.YourModel.newQuery();
query.filters.Field._equals = widgetValue;
var records = query.run();
return records[0].Token;
}
You can add the script caller checkToken(widget.value) to the onValueEdit event of widget, so that it runs every time you select another dropdown item. If you want to use another event, please look at https://developers.google.com/appmaker/ui/logic#events.
As a second option you could add a secondary label to your form which you bind to the dropdown item selection. The binding would look something like this:
#pages.MyPage.descendants.DropDown.value.Token
When you configure Dropdown you need to set three important properties:
options
An array of string representations of options that makes up the content of the dropdown
#datasources.MyDatasource.items..Token
names
An array of strings to be displayed in place of options' default strings. The array must be the same length as options.
#datasources.MyDatasource.items..Name
value
The value assigned to the databound property, based on the user's dropdown selection
// Assuming that dropdown is added to form
// or any other container bound to proper datasource.
#datasource.item.Token
Note
double dot .. syntax is used for projections

getting textfield output partly unvisible

In a Drupal content type a need to get the output of a field partly unvisible. These are bank account details, the IBAN.
Normally the field shows 1234567. I need to get xxxx567. I need to show only the last 3 numbers/letters.
Also I need this output in field edit form.
On the display end you could change the output using a simple PHP function in the theme template by grabbing a substring of the field's last three digits and concatenating it with "xxxx" before printing.
You might also consider doing this at the formatter level by using the 'custom formatter' module perhaps?
https://drupal.org/project/custom_formatters
To do this on the edit screen is trickier. I suppose you could do a hook form alter to use PHP to change the field value, but I am afraid you will rewrite the field value when you save the node with the 'xxxx' instead of the real data.
I wonder if it would make sense to 1.) hide the actual field, 2.) create a dummy field that displays the text formatted as "xxxx567" to the user, and 3.) write some javascript that populates the hidden field with the visible field's value if it is changed. Presumably the form would still throw values if the hidden field did not meet formatting requirements.

how get item from each cell in grid

I have form with grid. I defined dataStore with 2 columns (text and checkBox). Grid.store = defined dataStore. Second column is editable (you can change selection on each checkBox). I have some button, and when I click it, I want to get info about each cell. Example if have gird:
Name1 true
Name2 false
I want get info col[0].row[0] is equal 'Name1', col[0].row[1] is equal 'Name2'.
I try iterate on dataStore but it has only value which I put them by hand. The value which was changed on grid by clicking on checkBox didn't save in dataStore.. My question is how to iterate on grid, how get info about each cell.
To iterate across a store in Ext3, you can use dataStore.each()
Supply it an anonymous function and the parameter it receives will be the current record in the store. The data in the current record can be read by using record_var.get(field_name).
So, for example:
var dataStore = myGrid.getStore();
dataStore.each(function(rec){
alert(rec.get(field1));
}

Flex DataGridColumn with array of objects as data provider

I have a datagrid that uses an array of objects as the data provider. The objects are essentially key/value pairs:
{ foo:"something"}
{ bar:"hello"}
{ caca:"lorem"}
The datagrid has 2 columns. The first column is the key and the second column is the value. Right now my grid looks like:
My dataFormatter function makes sure that depending on the column (i.e. the dataField value) the correct key or value gets printed out. This works fine for displaying. However, as soon as I try and edit the value field it essentially adds a new value into the object with a key of '1'. For example, if I edit the {caca:"lorem"} object it will then contain the value {caca:"lorem",1:"new value"}.
Is there any possible way I can set the DataGridColumn so that when I edit a value it will update the value associated with the key rather than inserting a new value? I've tried using a custom item editor but it still does the insert. It seems like I need to be able to update the 'dataField' with the actual key value but I'm not sure how to do that.
Looks like you need to think about where your data is going to be stored. I would recommend listening for a CollectionEvent.COLLECTION_CHANGE event on your data model. That event object will contain info about what change occurred, and you can make any updates you need to make.

Resources