Menu

Multi-value hidden fields

2003-11-10
2003-11-10
  • Roger Altena

    Roger Altena - 2003-11-10

    Hi!
    We're trying to set a multi-valued hidden field using:

    protected void setHiddenField(String label, String[] values) {
      form.getScriptableObject().setParameterValue(label, values); }

    But this won't compile (there isn't a version that takes a String[]).

    We also tried setting an individual element:

      form.getScriptableObject().setParameterValue(label, values[0]);

    And this seemed to work but the field named "label" reverted to a single variable rather than an array, causing problems later.  I think doing this in a loop would just keep overwriting the one single variable value rather than building a collection of values.

    I would have thought I could use something like:

      form.getScriptableObject().setParameterValue(label + "[0]", values[0]);

    But I couldn't figure out the syntax of the first parameter to make this work.

    Any ideas how to do this?
    Thanks!
    Roger.

     
    • Bob Stine

      Bob Stine - 2003-11-10

      You could try the following WebForm method:

      setParameter
      public void setParameter(java.lang.String name,
                               java.lang.String[] values)

       
    • Roger Altena

      Roger Altena - 2003-11-10

      I tried

      form.setParameter(label, values);

      but got

      com.meterware.httpunit.MissingParameterValueException: Parameter 'xxx' must have the value ''. Attempted to set it to: {zzz}

      It seems that this function doesn't (function!).

       

Log in to post a comment.

Auth0 Logo