Using %begin_ with forms


(paul walker) #1

Hi Folks
In a custom form I have a select option

Using %response_1243681_q8% displays the users selection for example ‘choice 1’

However, . .

%begin_response_1243681_q8^eq:choice 1%
Yes
%else_begin%
No
%end_begin%

. . always returns ‘No’

I have tried using %begin_response_1243681_q8_value and %begin_response_1243681_q8_key - all to no avail.
Am I doing something obviously wrong?/
Kind regards
Paul Walker (not fast, not furious )


(Hugh McMaster) #2

This is a bug that has been around for some time.

Matrix is submitting the text, not the value. @Bart - can you please follow up with the team on this one?

You have two options. Either duplicate the value and option fields, or use good old-fashioned POST variables.

%begin_globals_post^index:q1243681\:q8^eq:choice 1% will do what you need. Just remember to keep the backslash to escape the colon.


(paul walker) #3

Hi Hugh
Thank you for you response but sadly this did not seem to work. I will continue to explore options
pw


(Hugh McMaster) #4

Can you post the output of %globals_post% from your Thank You body copy?


#5

Hi Paul,

I’ve had no issues using the %begin_% Keyword in a Custom Form Format Bodycopy. I think your Keyword in your example is a little off though.

Have you tried:

%begin_response_1243681_q8^eq:choice 1%
The choice is 1
%else_response%
The choice is NOT 1
%end_response%

Note #1: Use else_response and end_response instead of else_begin and end_begin.

Note #2: I’m not sure that the %begin_% Keyword will work in a REST Request Body (e.g. in a Form Submission Action). In that case, you would use an “inline” Keyword such as: %response_1243681_q8^eq:choice 1:The choice is 1:The choice is NOT 1%.

This all works for me in Matrix v5.5.6.4


(Hugh McMaster) #6

Hi James,

I’m also running 5.5.6.4 and Matrix is returning the text, not the value, for me.

Good pickup on the keyword syntax.


(paul walker) #7

Hi Hugh
{“SQ_FORM_1243681_SUBMISSION”:“1284713”,“SQ_FORM_1243681_PAGE”:“1”,“form_email_1243681_referral_url”:“http://intranet.heti.nsw.gov.au/our-people/employee-recognition/Recognition-eCard/_nocache",“q1243681:q1”:"Archibold Snodgrass”,“q1243681:q3”:“paul.walker@health.nsw.gov.au”,“q1243681:q5”:"waesvafev aefbeabf ",“q1243681:q8”:“https://www.heti.nsw.gov.au/?a=609084",“form_email_1243681_submit”:"Preview your card”}


(paul walker) #8

Hi James - this appears to work in the bodycopy (thanks) But I am having difficulty passing this on to the actual email - will explore
cheers
paul


(Hugh McMaster) #9

“choice 1” doesn’t appear at all, which is odd. q8 now has a URL, so now I’m interested to see how you set up the text and value parts of the select field.


(paul walker) #10

https://www.heti.nsw.gov.au/?a=609084 Decide. Commit. Succeed

The url is a link to an image that I can display in the email the form sends


(Bart Banda) #11

What type of form field is 1243681_q8? Is it a checkbox or radio button or select or something else?

Just trying to figure out how I can replicate to see if it’s a bug still or not.


(Hugh McMaster) #12

It’s a select field.


(paul walker) #13

Hi Bart – sorry for taking so long to respond, _q8 is a ‘select’ but that aspect of it is working fine

I suspect what I am trying to achieve is not a bug rather, something too complicated I am trying to set up.

I am developing a form so that people can send e-recognition cards to another person via email

My select is set up like so

URL-to card-image – card message

E.g., (www.mysite.helpful-person.jpg – You have been a helpful person)

The above works fine and the email sent displays both the image and the message

However, what I am ALSO trying to achieve is that the email should contain additional text based on what select was chosen – thus

If _q8 =” You have been a helpful person” then “Well done, we need more like you”

Else if _q8 = “x” then “y”

This is the part that is falling over for me – not, I believe, a bug, more my lack of experience or a limitation of the system

Please don’t lose sleep over it – you are always very helpful and I do not wish to cause you pre-xmas angst :blush:

paul


(Hugh McMaster) #14

It’s interesting. James and I are running v5.5.6.4. Consider this simple form that only contains a select field.

image

My system does not work as expected:

<p>Response is: %response_112041_q1%</p>
<p>POST response is: %globals_post^index:q112041\:q1%</p>

<p>Is the keyword response "option 1"? 
%begin_response_112041_q1^eq:option 1%
YES
%else_response%
NO
%end_response%
</p>

<p>Is the POST response "option 1"? 
%begin_globals_post^index:q112041\:q1^eq:option 1%
YES
%else_response%
NO
%end_response%
</p>

This produces:

Response is: A

POST response is: option 1

Is the keyword response "option 1"? NO

Is the POST response "option 1"? YES

(Bart Banda) #15

The example you posted does look like it works as expected?

@paul
What method are you using to send the email? I wonder if you could try using the send email form submission action instead of the usual email options format to see if that works? Or potentially use a trigger?


(Hugh McMaster) #16

So, the issue (as I see it) is that `%response_xxxx_q1% isn’t returning the value of the selected option. It’s returning the human-readable text, which I’m not interested in. Forms return the value.