问题
I defined a document datasource(called document1) in a panel in my extlib dialog box. Within this panel, it contains dialog content and dialog butotn bar. Within the dialog content, in contains a custom control that has all the components likes dojo edit box, list box, radio butotn etc. Within the dialog button bar, it contains a Save button. On save, I could not get the value from any component by the following getComponent, document.getDocument.getxxx:
print (getComponent.getValue("control"));
print (document1.getDocument(true).getValueInString("control"));
print (document1.getValue("control"));
Interesting to do know that document1.sertValue("control", newvalue) and document1.getDocument(true).isNewNote() are all working.
The dialog box is opened from a view column in the repeat. All data are shown in dialog box corerctly. I could save the modified data, retrieve them and display them with no issue. The only thing that i could not get their values for processing.
The Save event handler is full update with set partial execution mode for the panel
panel is ignore its parameter and set scope to request but no luck.
Your help is really appreciated. Thanks in advance.
回答1:
There are a number of things you need to consider and/or check:
- make sure you actually got hands on that control. Since it is inside a custom control you easily could have more than one of them. In this case you either need your own function
getComponentChild(parentName,controlName) or (IMHO better) you read it from the compositeData of the customControl (which is a MAP)
- when you bind a control, it is esier to go after its binding than to use
getValue()
. So when you bind todocument.subject
, look for that value (orviewScope.someValue
if you bound it to the viewScope) - if validation fails in the submission or you query at an earlier phase, you can't use
getValue()
but need to use getSubmittedValue() since that contains the raw value before validation happened
Let us know how it goes
来源:https://stackoverflow.com/questions/14043105/xpages-get-component-value-in-extlib-dialog-box