• Resolved contactovisualpt

    (@contactovisualpt)


    I’m trying to add a hidden field that gets different values depending on options on the form, but the uploaded content is stored with always the same value, the last one.

    Something like this:

    [hidden email-do-servico “”]

    [group cc-informatica-pc][hidden email-do-servico “[email protected]”][/group]
    [group cc-informatica-impressoras][hidden email-do-servico “[email protected]”][/group]
    [group cc-outros-equipamentos-a-reparar][hidden email-do-servico “[email protected]”][/group]
    [group cc-apetrechamento-cantina][hidden email-do-servico “[email protected]”][/group]
    [group cc-apetrechamento-informatica][hidden email-do-servico “[email protected]”][/group]

    and

    show [cc-informatica-pc] if [informatica-equipamentos] equals “Computadores”
    show [cc-informatica-impressoras] if [informatica-equipamentos] equals “Impressoras”
    show [cc-outros-equipamentos-a-reparar] if [equipamentos-que-necessitam-reparacao] not equals “Informática”
    show [cc-apetrechamento-cantina] if [que-equipamentos-necessita] equals “Cantina”
    show [cc-apetrechamento-informatica] if [que-equipamentos-necessita] equals “Informática”

    I need the field email-do-servico to assume one of the possible options above, or be empty if anything else. What happens is that, maybe because is the same field name, what is stored in the wp_postmeta values, meta_key _field_email-do-servico is always the last one (in this example, [email protected]), no matter what option is selected by the user.

    Is it possible to do this?

    By the way, I also use this strategy to put the email in the CC, and it works great, but I also need the right email in the postmeta value.

    Nelson

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jules Colle

    (@jules-colle)

    You could add it like this in the To field:

    [cc-informatica-impressoras][email protected][/cc-informatica-impressoras][cc-outros-equipamentos-a-reparar][email protected][/cc-outros-equipamentos-a-reparar] ...

    Or if you want to use the actual values from the hidden fields, you will need to rename the hidden fields to email-do-servico-1, email-do-servico-2, … and then you could use:

    [cc-informatica-impressoras][email-do-servico-1][/cc-informatica-impressoras][cc-outros-equipamentos-a-reparar][email-do-servico-2][/cc-outros-equipamentos-a-reparar] ...

    Thread Starter contactovisualpt

    (@contactovisualpt)

    Thank you for the quick answer.
    I do that in the CC, not in the To field, and it works great. But that is just part of it. Actually I need the email-do-servico field to assume a different value, and that it is stored in the database (I use Flamingo to do that). That field is later read in a custom page to identify a service email.
    It’s what I find in the wp_postmeta:
    meta_key: _field_email-do-servico
    meta_value: (whatver the email is)
    If I use different names for the field, they will be stored like this:
    meta_key: _field_email-do-servico-1
    meta_key: _field_email-do-servico-2
    etc
    Not good.

    Plugin Author Jules Colle

    (@jules-colle)

    this is one of the shortcomings of my plugin. You can only hide/show fields dynamically, but for the moment it is not possible to use the same field name more than once or to populate field values dynamically. You’ll need to write some custom javascript to update the hidden field value.

    Thread Starter contactovisualpt

    (@contactovisualpt)

    OK. I was wondering if your PRO version would handle this…
    I’m thinking in a postprocess solution in php (not very comfortable with js), but I hope your plugin will have this option soon. It’s a great plugin. I pushed it really hard with a lot of conditions, and other than this one, it works great. ?? Congratulations. You deserve 5 stars.

    Plugin Author Jules Colle

    (@jules-colle)

    Why thank you! No, for the moment the PRO version only supports fields with the same name if they are inside a repeater, which is not useful is your case.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Same hidden field, different values’ is closed to new replies.