This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 3

URL parameter settings for multiple choice


  1. ls75
    Member

    How do you go about setting these field types in the URL? I've read some documentation about this already and can get it to work for text fields, but am stumped with the multiple choice fields.

    element_15 has two options element_15_1 which is Yes, and element_15_2 which is No. No is the default, but I would like to override this in the URL to Yes for some clients.

    Thanks for the help

    Posted 12 years ago #
  2. ls75
    Member

    The best I can figure out on this so far is that if you have set a default for a multiple choice field, you cannot override this with a URL parameter. In my testing, I started with a default of No and tried to override to Yes in the URL. This would not work. Second test I removed the default setting and left both elements unchecked. With this setup I WAS able to set a value from the URL using element_15=1 for Yes.

    Let me know if this result can be reproduced or not. It would really be nice to have a default set but override with the URL parameter. Thanks.

    Posted 12 years ago #
  3. yuniar

    For multiple choice, you need to view the HTML source of the field and see the "value" attribute.
    So for example, if you have Yes and No, the HTML code would be something like this:

    <span>
      <input id="element_1_1"  name="element_1" class="element radio" type="radio" value="1" />
      <label class="choice" for="element_1_1">Yes</label>
    </span>
    <span>
      <input id="element_1_2"  name="element_1" class="element radio" type="radio" value="2"  />
      <label class="choice" for="element_1_2">No</label>
    </span>

    You can pass the parameter like this:
    http://www.example.com/machform/view.php?id=12&element_1=1

    that would select the "Yes". To select "No", you can do like this:
    http://www.example.com/machform/view.php?id=12&element_1=2

    the URL parameter should override the default value. If this is not the case for you, can you let me know the URL of your form please?


    MachForm Founder

    Posted 12 years ago #

RSS feed for this topic

Reply