cancel
Showing results for 
Search instead for 
Did you mean: 

Object not found with myContext.getParamIdForComponent

Former Member
0 Kudos

Hi all!

I have a problem with the javascript for accepting a hit of return button as method of confirmation. I have added a SPAN tag with an onkeypress attribute and then added a javascript with a function to the inputField of interest.

To enter a value in the field works fine (not so surprising). My problem is when you hit "Return", I then get an javascript error in the browser saying: "Error: Object doesn't support this property or method". I have copied the code pieces from a working project and the only difference is that the button is defined earlier in the code than the inputField. Could this be the probleme? And if so, how do I solve it without changing the order of the objects?

Here is the code for the button in question:


			<TD align="right">
				<hbj:button
					id="btnChangeCustomerInfo"
					text="<%= languageBean.getButtonNextText() %>"
					onClick="ChangeCustomerInfoClicked"
					onClientClick="checkCustomerId();"
					disabled="FALSE"
					design="EMPHASIZED"
					jsObjectNeeded="true"	>
					<SCRIPT>
						function toChangeCustomerInfo() {
							<%=myContext.getParamIdForComponent(btnChangeCustomerInfo)%>.click();
						}
					</SCRIPT>
				</hbj:button>
			</TD>

and here is the one for the inputField:

				<td width="74%" bgcolor="#FFFFFF">
					<SPAN onkeypress="JavaScript: if (window.event.keyCode==13){toChangeCustomerInfo();};">
						<hbj:inputField
							id="customerNbr"
							type="string"
							width="100%"
							value="<%= dataBean.getCustomerNbr() %>"/>
					</SPAN>
				</td>

Most grateful for any help!

Best regards

Benny

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I found the solution through trial and error: if you remove the attribute 'jsObjectNeeded="true"' hitting "return" works fine. The javascript problem is gone. Of course this solution raises the question, which I will post separately, about a solution where you can have both scripts working.

Regards

Benny