Skip to Content
author's profile photo
Former Member

Get InputField value

Hi all,

How can get InputField value in abstract portal component?

Please, help me!

thanks in advance

Stefano

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • author's profile photo
    Former Member
    Posted on Jan 03, 2005 at 05:27 PM

    Your question is too ambigious. Need to give more info. Such as, is the input field just in the java code? Or, Did you use jsp to diplay the input field. Did you use a button's function onClick() so that it triggers an event?

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Stefano,

      Are you asking to get the value of an HTMLB input field in a javascript function before you submit the form? (for example to do client side validation). If so, here is a sample piece of code.

      Hope this helps,

      Marty

      ********************JAVASCRIPT FUNCTION ************

      function searchSubmit(type)

      {

      var funcName = jsFormID+"_getHtmlbElementId";

      func = window[funcName];

      //get the query text string

      var searchTextID = eval(jsSearchID);

      var searchText = searchTextID.getValue();

      //assign the values to a hidden form and submit the form to the search jsp

      document.forms['submitSearch'].query.value = searchText;

      document.forms['submitSearch'].submit();

      }

      .......

      <hbj:form id=search_form method="post" action="<%=searchURL%>" target="_blank">

      <% String formID = PageContext.getParamIdForComponent(search_form);

      }

      %>

      <SCRIPT> var jsFormID = "<%=formID%>"; </SCRIPT>

      <hbj:inputField

      id="searchText"

      type="string"

      maxlength="15"

      width="75"

      jsObjectNeeded="true"

      >

      % String searchID = PageContext.getParamIdForComponent(searchText); %>

      <SCRIPT> var jsSearchID = '<%=searchID%>'; </SCRIPT>

      </hbj:inputField>

      <hbj:button

      id="submit_basic_search"

      text="Go"

      width="45px"

      tooltip="Click here to submit search"

      onClientClick="searchSubmit('button')"

      disabled="false"

      design="STANDARD"

      />

      ..........place hidden form here if you are submitting form for another website or page outside of this portal component, if not you can access HTMLB field from Java class you are using and place back into a bean....