Q:
Using the tried and true Lianja.get("page.section.field") works fine until I try it in a web page. Looking at example_webapp3, the fields are simply referenced directly by their name. No page, no section, just name.
A:
This applies to the Canvas controls. If you wanted to reference a formitem in the 'Customer' Form Section in example_webapp3, you would use the Lianja.get() syntax
You reference the fields directly by variable name in both desktop and web for javascript canvas sections.

Q:
Code:
?empty(Lianja.Get("page.section.txt1").text) .and. empty(Lianja.Get("page.section.txt2").text)
"Syntax error in expression"
A:
Code:
? (empty(Lianja.Get("page.section.txt1").text)) and (empty(Lianja.Get("page.section.txt2").text))


Q:
why in some cases, calling a method or property directly works (which is what I was trying to do), while other times, such as this one, it is required to place something into a variable and then call different properties/methods with the variable.
A:
You can also do:
Code:
? Lianja.GetElementByID("page.section").grid.ColumnCount
or
Code:
? Lianja.get("page.section").grid.column(2).header1.caption
But, you do have to call the property/method on the relevant object where these are compound objects. A grid section is a grid within a section and is composed of columns, each of which has a header.




Q:
Grid
Code:
?Lianja.GetElementByID("page.section").ColumnCount
A:
Get the grid object reference from the section:

Code:
oGrid = Lianja.GetElementByID("page.section").grid
? oGrid.ColumnCount


In Standard and Canvas sections you can use the hierarchy, (Lianja.getObject("page1.section1") etc.) but in the Recital/VFP Custom Sections and Gadgets, you need to declare a public reference to the object if you want to access it outside of its creation procedure. This can be in a namespace, as in my example below (a namespace statement for the App is added automatically), which means I could have another optgrp in another namespace and still reference this one using herb1.optgrp.



When you use the Lianja.getElementByID, you can either use the control name on its own if it is unique, e.g.
Code:
Lianja.getElementByID("Gkz").additem(<item>)
or with the object hierarchy, e.g.
Code:
Lianja.getElementByID("Inventurauswahl.NameOfCanvasSection.Gkz").additem(<item>)
If you are using a single database throughout the App, then put the open database cipinventur in the App (Settings) Init Event Delegate. You can SELECT the data into an array or cursor.



In v1.3 the following attributes have been added.
In a formitem:
sectionid
pageid
In a section:
pageid



In your code you are updating the field on the form by assigning it a value in the dialog button delegate.
When assigning a textual value like that you need to update the bound data source in your case the field in the table.
Only interactive changes to the fields will update the bound data source not programmatically doing it in a delegate.
Also remember that if you update the data source e.g. a field in a record or a variable then you refresh the formitem it will reflect the current value.



Note that Lianja.get() does not require "page:", you are looking up the object.
Lianja.showDocument() has many different commands so you need to specify "page:"



Q:
Using the tried and true Lianja.get("page.section.field") works fine until I try it in a web page.
Looking at example_webapp3, the fields are simply referenced directly by their name. No page, no section, just name.
For example, this is used to clear the fields when a button is clicked.


Code:
function page1_section2_field23_click()
{
        m_companyname.text = "";
        m_companyregion.text = "";
}

I was certain that this was working before.
Code:
Lianja.get("page.section.field")
A:
Yes you reference the fields directly by variable name in both desktop and web for javascript canvas sections.
Note, that this applies to the Canvas controls. If you wanted to reference a formitem in the 'Customer' Form Section in example_webapp3, you would use the Lianja.get() syntax, e.g.


Code:
////////////////////////////////////////////////////////////////
// Event delegate for 'click' event
function page1_section2_field23_click()
{
        m_companyname.text = "";
        m_companyregion.text = "";
        messagebox(Lianja.get('page1.section1.field1').text);
}


Q:
Code:
Lianja.showDocument("Page:pgAppendVoterData")
or
Code:
Lianja.showDocument("page:pgAppendVoterData")
A:
page: is case sensitive as are all the actions.





​All topics in [Answers] alphabetically:http://www.lianja.com/community/show...ll=1#post12352