on 01-31-2005 3:45 PM
Hi all,
I have an iview that receives an event. I tried to work with JSP this time. After I received the event I have a java-script var. I would like to put the content of the var into a htmlb-component:
<script>
EPCM.subscribeEvent( 'urn:com.test.EPCFExample', 'Event', getEvent);
function getEvent( evt ) {
var nameEvent = EPCM.loadClientData('urn:com.test.EPCFExample','textInput');
}
</script>
I have completly no clue what to do with the variable. Can this be transferred into a java-String? If I use it as value-parameter for an InputField it will be interpreted as a String ;-(
<hbj:inputField
id="eventField"
value=nameEvent
width="90"
visible="TRUE"
disabled="TRUE"
/>
Thanks for any help!
Martina
Hi Martina,
to access HTMLB elements as JS HTMLB objects, the following function you should always wear in your pocket:
function getHtmlbElement(pElementId) {
var loDocForms = document.forms;
for (var j = 0; j < loDocForms.length; j++) {
try {
var funcName = loDocForms[j].id + "_getHtmlbElementId";
func = window[funcName];
var element = eval(func(pElementId));
if (element != null) {
return element;
}
} catch(ex) {
}
}
Setting "nameEvent" into the HTMLB tag cannot work because this is calculated at server side (it's JSP - Java).
With the method given above, you retrieve the HTMLB JS object, here the HTMLB JS object InputField, when you write (and have set JSObjectNeeded to true):
var myInpField = getHtmlbElement('eventField')
On this object, you can set a value by
myInpField.setValue(EPCM.loadClientData('urn:com.test.EPCFExample','textInput'))
I didn't test it (the last combination), but it should work.
A general question is if it is really needed to pass the data via ClientDataBag. Why not passing as a value of the event?
Hope it helps
Detlev
PS: https://forums.sdn.sap.com/thread.jspa?threadID=26357 wasn't helpful? No reply, no points, nothing?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.