Closed zottto closed 8 years ago
Similar to how Contact Form 7 does this: http://contactform7.com/getting-default-values-from-the-context/
I have added the possibility to add preselected values by $_GET param.
You also cen preset the value by filtering 'torro_input_value' filter.
Filter:
apply_filters( 'torro_input_value', $value, $element->id );
Hi @mahype,
I tried that with a checkbox. The URL looks like: http://my-site/kontakt/?torro_input_value_torro_form_element_5-1=true
I also tried "1" and "checked" as value, but the checkbox is not selected.
What am I doing wrong?
Thanks, Marc
@zottto: Preselecting a checkbox or radio buton requires the attribute checked="checked"
to be set,
5f92b63d40e6b7a964ea3709422d7f3c739c4354 only changes the value
attribute.
So you'll have to wait for @mahype to extend this feature.
As discussed on Skype, now you can select the element value by the answer ID if you have preselected answers in case there is a complex text string.
This is already possible. Here is the list of all elements:
Textfield, Textarea ?torro_input_value_ELEMENTID=ANSWER_ID1
Onechoice, Dropdown ?torro_input_value_ELEMENTID=ANSWER_ID1
Multiple Choice for one value ?torro_input_value_ELEMENTID[]=ANSWER_ID1
Multiple Choice for multiple values ?torro_input_value_ELEMENTID[]=ANSWER_ID1&torro_input_value_ELEMENTID[]=ANSWER_ID2
Pleas get your element and answer IDs from the admin sourcecode.
It would be nice to have a hook when loading the form in the frontend to prefill fields or pre-select values (e.g. based on some URL parameters).