Menu

Unable to set text field with field ID

Max
2007-11-27
2013-04-25
  • Max

    Max - 2007-11-27

    Hi Christian,

    How I can set test field if <input> tag doesn't have 'name' attribute?

    <form id="oForm" onsubmit="submitSearch();return false">
    <div><input type="text" class="form-control" id="searchTextField" size=25 onkeyup="checkField(this.value)" onpaste="checkField(clipboardData.getData('Text'))" onclick="checkField(this.value)"></div>

    Error Message: searchTextField does not exist as a text field in the current form!

    My tag:
    <jm:ie-set-text-field
        functionId="Enter product code - '${csvProdCode}' into text field"
        frameName="frameset,menutree,menuTree"
        name="earchTextField"
        value="12345"
        eventToFire="onkeyup"
        functionDelay="300"/>

    Please advice?

     
    • Max

      Max - 2007-11-27

      I made typo

      My tag:
      <jm:ie-set-text-field
      functionId="Enter product code - '12345' into text field"
      frameName="frameset,menutree,menuTree"
      name="searchTextField"
      value="12345"
      eventToFire="onkeyup"
      functionDelay="300"/>

       
      • Christian Hargraves

        As far as I know, you'll need to write a custom tag until I get around to supporting XPath in that tag.

         
    • Max

      Max - 2007-11-28

      I wrote custom tag, but still having problem to set text field.

      Below is source of custom tag
      --------------------------------------------------------------------------
      import net.sf.jameleon.plugin.jiffie.tags.IEFireEventTag;
      /**
      * DESCRIPTION GOES HERE
      * @jameleon.function name="product-search" type="action"
      * @jameleon.step Set searchTextField text field ID if value is provided
      */
      public class SearchProductTag extends IEFireEventTag{
         /**
          * the form identifier
          * @jameleon.attribute default="1"
          */
         protected String formIdentifier;
         /**
          * The name, id or index of the field
          * @jameleon.attribute contextName="ieValidateTextFieldForm"
          */
         protected String form;
         /**
          * searchTextField
          * @jameleon.attribute required="false"
          */
         protected String searchTextField;
         /**
          * The value to set the text field to
          * @jameleon.attribute required="true" contextName="ieSetTextFieldValue"
          */
         protected String value;
        
         public void testBlock(){
              setWorkingForm(form);
              if ( searchTextField != null ){
                  fireEvent(setTextFieldValue(searchTextFieldID, searchTextField));
              }
              //submitWorkingForm();       
         }
         /**
          * searchTextField's field id
          */
          protected String searchTextFieldID = "searchTextField";
      }

      Custom tag itself
      ---------------------------
      <jm:product-search
          functionId="Enter product code - '${csvProdCode}' into text field"
          frameName="frameset,menutree,menuTree"
          form="oForm"
              searchTextField="searchTextField"
              value="${csvProdCode}"
          eventToFire="onkeyup"
          functionDelay="300"/>

      Please check what should be done to make custom tag working?

      Thanks.

       
      • Christian Hargraves

        Try:

        ...
        if ( searchTextField != null ){
          IHTMLInputElement searchField = (IHTMLInputElement)getIHTMLElement("input", "id", searchTextFieldID);
          assertNotNull("Can not find search field '"+searchFieldId+"'", searchField);
          searchField.setValue(searchTextField);
          fireEvent(searchField);
        }
        ...

         
    • Max

      Max - 2007-11-28

      I'm getting error in source file.
      "IHTMLInputElement cannot be resolved to a type"

      Line:
      IHTMLInputElement searchField = (IHTMLInputElement)getIHTMLElement("input", "id", searchTextFieldID);

       
      • Christian Hargraves

        Did you import com.tapsterrock.jiffie.IHTMLInputElement?

         
    • Max

      Max - 2007-11-28

      I forgot to add import. Now its work fine.

      Thank you for help.

       

Log in to post a comment.