PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

How do you set the values of fields to be different from the displayed value?

  1. Just purchased a five-site license in hopes that this plugin would speed up some projects. Looks promising, but there is a) a pretty bad lack of documentation for a commercial plugin; and b) a lot of jquery errors (things like clicking on the help button in some fields will throw an error). I know Wordpress can make it challenging with theme / plugin compatibility, but I honestly haven't run into this level of problem with other plugins I used or written. That said, still seems like a very promising project.

    What I'm trying to do is set up a multiple choice (radio button) field with options for membership types for a client. Each one should have as its displayed value the type of membership, and as its stored value, the price of that membership. Hopefully I'm just missing something really obvious as to how you set those values. Can someone point me in the right direction? I

    Posted 14 years ago on Monday February 15, 2010 | Permalink
  2. On your first two points:

    - What documentation are you unable to find?

    - If you are encountering jQuery errors than it is a conflict of some sort. Nobody is reporting any errors and out of the box it does not throw any errors.

    We have a large user base and as you can tell by browsing the forum, if there was a plugin wide issue we would be getting slammed with questions and we are not. So any jQuery errors you are encountering are specific to your site/install.

    As far as option/values for drop downs, radio buttons and check boxes it is currently not an option. We intend on implementing this feature in an upcoming release, but currently there is only a single value.

    It is possible to use one of the available API hooks to populate fields dynamically and pass a different value in the process. But it isn't a built in feature of the UI. We do plan on adding it. But we want to make sure the UI and usability makes sense before doing so. We add features slowly and pay close to attention to usability.

    If you want to use an available API hook to populate field values (with different value) programmatically we would be glad to point you in the right direction with an example code snippet.

    Posted 14 years ago on Monday February 15, 2010 | Permalink
  3. I guess the API hook is what I'm going to have to do for this application then. Here's what I need to accomplish:

    Someone fills out a membership form with a multiple select field for the types of memberships. The labels for those options have to be descriptive (Annual, Monthly, etc.) but the value I want to pass is the price of the membership as this is feeding into an online payment system. I'm using a jQuery script on the form to automatically update a total field on the form as the member selects various options. Easy enough if the value of their selection is the $ value. If I were hard coding a form, it would be something like "<input id='mtypes1 type='radio' value='500'><label for='mytpes1''>Annual Membership -- $500</label>, etc.

    So any help where to look to have the input value and label be different would be appreciated.

    Posted 14 years ago on Monday February 15, 2010 | Permalink
  4. I posted a quick jQuery solution on this thread that should do what you need.

    http://forum.gravityhelp.com/topic/unnecessary-esc_html-in-get_checkbox_choices#post-3413

    Posted 14 years ago on Tuesday February 16, 2010 | Permalink
  5. Thanks Kevin. I actually ended up using jquery myself and then saw your post. I went a slightly different route for doing radio button custom labels. I used the values I wanted to display when I created the radio buttons (as in, made the first option "Annual Membership," second one "Seasonal Membership," etc. What I wanted was to make selecting one of them automatically update a "Total Fees" field. So I used jquery to check which button was selected and figure the price accordingly based on their index value.


    $jq("input[name='input_37']").click(function(){
    var index = $jq("input[name='input_37']").index(this);
    switch(index){
    case 0: fee=500;break;
    case 1: fee=250;break;
    case 2: fee=250;break;
    case 3: fee=0;break;
    }
    updatetotal('fee', fee);
    });

    Each click on a radio button thus assigns the correct price to the fee variable, and then a function called update_total() runs which calculates the new running total and updates a field on the page.

    Posted 14 years ago on Thursday February 18, 2010 | Permalink
  6. Clever solution. Thanks for sharing it.

    Posted 14 years ago on Thursday February 18, 2010 | Permalink
  7. has this feature (different value to displayed value) been added yet?

    (with my limited JS skiils) i can't use this jQuery solution as it needs to be dynamic, in that if my client updates the form the JS array won't know the new values

    Posted 13 years ago on Tuesday May 10, 2011 | Permalink