Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Posting the actual value in a select list

    I have a select list in my form and I need to pass the actual value (1) not (one) just as in an html form:
    <option value=”1”>one</value>.
    It seems like it only passes the displayed value (one). How can I accomplish this?
    I also noted that without the editorType: "comboBox" in the select field it does not pass any value at all.

    See code below:

    <script>
    isc.DynamicForm.create({
    method: "get",
    action: "index.cfm",
    ID: "exampleForm",
    width: 250,
    position: "relative",
    fields: [
    {name: "Site",
    title: "Site",
    editorType: "comboBox",
    type: "select",
    required: false,
    valueMap: {
    "1":"one",
    "2":"two"
    }

    },
    {name: "submit",
    required: true,
    title: "Search",
    type: "submit"
    }
    ]
    });
    </script>
    Last edited by dformica; 15 Feb 2007, 06:08.

    #2
    Hello dformica,

    First question - are you sure you want to do a normal HTML form submit? Although SmartClient's DynamicForm's retains the ability to do basic HTML submits, the flexible client-server integration facilities have obsoleted that approach for all but a few edge cases.

    As far as your example, you need to set canSubmit:true, which causes extra hidden HTML form elements to be created to represent values held by SmartClient's form controls. This was inadequately documented in 5.5.1 (appearing only in the Struts examples in the SDK) but has since been corrected - sorry you ran into it.
    Last edited by Isomorphic; 15 Feb 2007, 11:42.

    Comment


      #3
      Thank you for your response.
      No, I don’t want to do a normal html form. I want the select list and radio buttons to send their values as they do in a HTML form.

      I have added -> canSubmit:true
      But my list still submits the value “one” instead of “1”.
      valueMap: ["1" : “one”]

      Comment


        #4
        Hello dformica,

        If you use a SelectItem and do a submit with canSubmit:true, you'll see the values from the valueMap used.

        With a comboBox, where the user can enter values that do not appear in the valueMap, we don't automatically convert the displayed value to the valueMap value on a HTML form submit.

        However, I want to recommend again that you take a look at the client-server integration documentation. It's likely that you are persuing an integration strategy that is more difficult than it needs to be.

        Comment


          #5
          Thank you, that worked.
          But now the rest of the fields in the form that are submitted with no value or blank get submitted with the value of ‘undefined’.
          Is there way to have the the empty fields get submitted blank?
          I have tried defaultValue="" for each field but no luck.

          Comment


            #6
            You can avoid this by making the blank entry an official part of the valueMap, like so:

            Code:
            {name: "Site", 
              title: "Site", 
              type: "select",
              defaultValue:"",
              valueMap: {
                  "1":"one",
                  "2":"two",
                  "" : ""
              }
            }
            I should mention that none of these issues occur with normal SmartClient databinding, only with the legacy pathway you are using (native HTML form submit). If you call exampleForm.getValues() you'll see the logical values relied upon by all other SmartClient subsystems, and they are exactly as you have been expecting to find using your current approach.

            Comment


              #7
              Is there an example of a form that would post and display the values entered to better understand how to use the getValues() method.

              Does DymanicForm post form values as javascript values?

              Comment


                #8
                You can find a selection of running examples demonstrating client/server communication in your SDK here: http://[host:port]/examples/server_integration/index.html

                These demonstrate a number of ways to use the SmartClient RPCManager code to perform communication with the server, from a direct RPC call (passing in arbitrary data, which could be gleaned from a form via a simple 'getValues()' call), to using a DataSource to specify the fields to display in a form (or other component), and using standard flow methods such as "DynamicForm.saveData()" to pass the data to the server.
                All running server code is of course included for each of these examples

                For more information on the recommended client-server communication approaches, we also suggest you take a look at the documentation here: http://www.smartclient.com/docs/5.5....verIntegration.

                Regards
                Isomorphic Software

                Comment

                Working...
                X