Skip to Content
author's profile photo Former Member
Former Member

How to get a value from a <hbj:form>...

Hi, I am a beginner in HTMLB, and I would like to learn to use Javascript with HTMLB. I am trying to print out the <b><hbj:input></b> value whenever a button is clicked using javascript. However, I am getting an javascript error that says, <b>"ERROR: Object expected"</b>

*I have included code below

Does anyone know the fix to this?

Greatly appreciate for any code samples, or suggestions!,



<%@ taglib uri="tagLib" prefix="hbj" %>

<SCRIPT LANGUAGE="JavaScript" TYPE="text/JavaScript">

function test(){

var inputText = document.getElementById("testInput").value;

alert("test, inputText = " + inputText);



<hbj:content id="myContext" >

<hbj:page title="Initial Page">

<hbj:form id="myFormId">






<hbj:button id="button328"

text="Initial 328"


onClientClick="test()" />




Message was edited by: Baggett Soran

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 10, 2005 at 10:15 PM

    Hi Baggett,

    Try this.

    var funcName = htmlb_formid+"_getHtmlbElementId";

    func = window[funcName];

    var inputText = (eval(func("testInput"))).getValue();

    alert("test, inputText = " + inputText);

    Don't forget to reward points:-)



    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Dhiman! Thanks for your great response, it works! I apologize for the late reply b/c I've been sick. Regarding your code, I have some knowledge questions that I hope you can help me learn about:

      <b>1.)</b> The htmlb_formid and "_getHtmlbElementId", where do they come from? Are these implicit objects?

      <b>2.)</b> Where can I learn more about this (Javascript with HTMLB)?

      Thanks so much!


Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.