cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieving HTML elements' ids in Java

Former Member
0 Kudos

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

I'm facing a problem when trying to retrieve an HTML element id in my DynPage, for use in JavaScript.

I've tried to call getPageContext().getParamIdForComponent(component) method inside the "doProcessBeforeOutput()" method, but kept receiving the following Jave Runtime Excpetion message:

"Component ... not found in old form"

After inspecting the matter, I found out that the method returned the id of the HTML input in the old form, the one that had submitted itself and called this IView's instance.

Instead, I would like to receive the FUTURE id of the HTML input that is to be put in the form which is built in "doProcessBeforOutput()" method.

Any ideas?

I know that calling the method in JSP from the context DOES work.

How does it work in JAVA?

thanks in advance .

Former Member
0 Kudos

Hi,

The following code to get the id might help.

<hbj:inputField

id="txtBillNo"

type="STRING"

maxlength="10"

value="Sample"

required="FALSE"

width="100"

design="STANDARD"

>

<%

strBillNo=myContext.getParamIdForComponent(txtBillNo);

%>

</hbj:inputField>

Declare a variable String strBillNo at the beginning of JSP page.

Vivek

Former Member
0 Kudos

Thank you Vivek,

BUT as I wrote, I KNOW that this works for JSP (I tried it myself).

However, the difficulties arise when I use HTMLB in a JAVA DynPage (not JSP).

still any ideas?

thanks.

Former Member
0 Kudos

Hi,

Here is what I use:

this.pageContext.getParamIdForComponent(myInputField);

Where "myInputField" is the object not the String of the ID, which is not working for me. This returns the JS object name in the HTML page.

If you need to get the form name use the following code:

this.pageContext.getCurrentFormId();

Regards,

Kai