2013-07-15 59 views
0

在Lotus Notes項目中,很容易在QueryOpen方法中自動訪問當前文檔,例如,從NotesUIDocument(參數)中提取它。如何使用Javascript獲取當前NotesDocument?

Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant) 

    //Here I get the document 
    Dim doc as NotesDocument 
    Set doc = Source.document 

End Sub 

我怎樣才能做到這一點,但在網上工作,使用Javascript?當然,不一定在QueryOpen方法中。

+1

你想實現什麼?要訪問「字段」,你可以簡單地做一個var doc = document.forms [0] ...並通過doc.FieldName.value訪問字段...但是在xpages中將會完全不同 –

+0

@Tode document.forms [0 ]工程。如果需要,請將其作爲答案發布,並將其設置爲最佳答案 – cgalvao1993

+2

要明確指出,通過JavaScript DOM訪問字段與訪問當前NotesDocument不同。它更類似於訪問當前的NotesUIDocument和使用fieldGetText。 –

回答

2

如果你只是想訪問文檔字段,那麼它是一件容易的事要做:

var doc = document.forms[0]; 
var yourfield = doc.YourFieldName; // take care: fieldname is case sensitive 
// to get a field- value; 
var theValue = yourfield.value; 
// to set a field value 
yourfield.value = "AnotherValue"; 

XPages中因爲有你有JavaScript類具有相似/同樣的方法/屬性,因爲這做法完全不同NotesDocument類來模仿LotusScript行爲