• Post Reply Bookmark Topic Watch Topic
  • New Topic

<h:outputText not found as form element question  RSS feed

 
Dan MacLeod
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a <hutputText element that I'd like to update the value from javascript. However the element is not found in the form. I can access all the other form elements, just not <hutputText elements. Does anyone know how to get around this? The code is running in a portlet on WLP 10.3.2, Code snippets below:

JSP
<f:view>
<h:form id="updaterForm">
<h:panelGroup layout="block" id="pg_geoWrapper">
<table id="t_geoFields">
<tr><td><hutputText id="ot_geoStatus" value="Status:"/></td></tr>
</table>
</h:panelGroup>
</h:form>
</f:view>

When a button is clicked the javascript is called

JAVASCRIPT
function displayProperComponents(myForm) {
var statusLabelId = null;

for(i=0; i<myForm.elements.length; i++) {
if (myForm.elements[i].id.indexOf("ot_geoStatus")>=0){
statusLabelId = myForm.elements[i].id;
}
}

if (document.getElementById(statusLabelId) != null){
document.getElementById(statusLabelId).innerHTML = '';
}
}
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!