How to convert values from select multiple into an email? - symphony-cms

How can I convert the selected options from a select multiple field into an email?
<select name="fields[issues][]" multiple="multiple">
<xsl:for-each select="//issues-all/entry">
<option value="{#id}">
<xsl:value-of select="title"/>
</option>
</xsl:for-each>
</select>
My standard approach doesn't work unfortunately:
<input name="send-email[body]" value="fields[name,address,phone,issues]" type="hidden" />
The email gets delivered but contains the value as a string rather than the actual values.
What am I missing here?
Thanks for any help.

Assuming this isn't a bug and the standard Symphony email event isn't supposed to be able to select options, it sounds like a job for Email Template Manager.

You should be able to also use:
<input name="send-email[body]" value="fields[name],fields[address],fields[phone],fields[issues]" type="hidden" />
As David mentioned though, Email Template Manager or Email Template Filter are great extensions to help you build more custom emails.

Related

How to pass custom amount with Bitpay hosted checkout form?

I am looking to integrate BitPay for processing bitcoin payments on one of my sites.
Their hosted checkout form (similar to PayPal checkout form) is easy to integrate however I don't know how I can pass order amount with the form so that the same checkout button can be used for different orders (payments).
Here's their page regarding hosted checkout: https://bitpay.com/help-hosted-checkout
Bitpay has clearly stated that we can pass different order amount but they have not provided any field for this on the above mentioned page. I have contacted them and they will reply in 3 days but since I need to integrate this at the earliest, I hope somebody here can help me fast.
Thanks.
I was also looking for help with a bitpay button for a project and found this question (and another one like it), so coming back to answer in case it can help others in the future: If you got your bitpay button code from the payment button option on bitpay, your code might look something like this:
<form action="https://test.bitpay.com/checkout" method="post">
<input type="hidden" name="action" value="checkout" />
<input type="hidden" name="posData" value="" />
<input type="hidden" name="price" value="<?php echo $price_var;?>" />
<input type="hidden" name="data" value="...(your data value)..." />
<input name="checkout" type="submit" value="Checkout" class="form-button-submit button"/>
</form>
Having the line of code with 'name="price"' allows you to set a global variable (potentially your shopping cart total) as an order amount. Hope this helps!

store data in drupal 8

I have created form using twig template, the form has first name,last name and email.I need to save those values to database.
how can I create new table and store data in it??
<!DOCTYPE html>
<html>
<body>
<form action="/action_page.php">
First name: <input type="text" name="FirstName"><br>
Last name: <input type="text" name="LastName"><br>
Email: <input type="text" name="email" value="Mouse"><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
Can anyone help on that please??
You should use drupal's form api to create the form. Your way is not really "drupalish" way. Then you can define custom content type, with all the fields you need and if form submission handler of your form you can create new nodes in that type with data your form collected.
So google a bit, check some tutorial on form api, and how to make custome form and also on custom content types in drupal. Not that scare as it maybe looks to you right now.
Or, check on webform module that comes with D8 default installation, maybe you can use it instead!

Detecting which option was selected by the buyer in PayPal IPN Listener

I'm testing my IPN handler with micro-payments using Live PayPal and I want to know how to detect what option was selected when the user clicked my PayPal "Buy Now" button. I've checked many places and found conflicting documentation and guidance.
Based on another StackOverflow thread, I added the last 4 hidden elements below to the SELECT drop-down OPTION(s) on the ASP.NET page with my Buy Now button:
<input type="hidden" runat="server" name="hosted_button_id" value="WYUM54ACPKUH6" id="hosted_button_id"/>
<input type="hidden" name="on0" value="SubType"/>SubType
<select name="os0">
<option value="S10">Standard (10 users) $0.04 USD</option>
<option value="ENT">Enterprise (unlimited) $0.05 USD</option>
</select>
<input type="hidden" name="option_select0" value="S10"/>
<input type="hidden" name="option_select1" value="ENT"/>
<input type="hidden" name="option_amount0" value="0.04" />
<input type="hidden" name="option_amount1" value="0.05" />
These are not being POSTed back. In a specific test case, I bought the "Standard" option for $0.04 and dumped out the Form variables posted back to my site from PayPal and here are the only things even close to what I am looking for:
option_name1 = SubType
option_selection1 = S10
payment_gross = 0.04
The threads I read and the doc I read emphasized the naming convention of the OPTION elements and the name and value of the corresponding hidden elements as being as shown above. YET - my testing indicates different things being posted back regarding the choice that was made by the user (i.e. me).
One specific thing is why the suffix is 1 when it seems like it should be 0 (since that first choice and it should be relative to 0). Is there anybody who can clarify what to expect?

Drupal 7 - privatemsg module - autocomplete customisation

I have a privatemsg module in Drupal 7, which uses autocomplete in field "To" (Do is polish translation). It looks very unattractive and I see no option to customise it unfortunately! I checked the code and I tried to modify it, but it doesn't work :o
<input type="text" id="edit-recipient" name="recipient" value="" size="50" maxlength="128" class="form-text required form-autocomplete" />
<input type="hidden" id="edit-recipient-autocomplete" value="http://niemiecki.dogadajsie.pl/messages/autocomplete" disabled="disabled" class="autocomplete" />
As we can see the autocomplete has id="edit-recipient-autocomplete" and class="autocomplete". When I modify it, it just doesn't work in any way. When I tried to search for reference to this id or class I found nothing. Can somebody tell me how to customise it?
Actually it looks like this:
http://i.stack.imgur.com/r6Gej.png
Kind regards, Michael.
What you are trying to modify with the field? You can use hook_form_alter to modify the field. The auto complete class is added because its explicitly set for auto complete.

How to disable multiple attribute in spring select tag

I have the following code:
<form:select path="roles" items="${roleList}" itemLabel="roleType" itemValue="id" />
It generates html as below:
<select id="roles" name="roles" multiple="multiple">
<option value="1">ROLE_ADMIN</option>
<option value="2">ROLE_HQ</option>
<option value="3">ROLE_MASTER</option>
<option value="4">ROLE_STATE</option>
<option value="5">ROLE_CENTRE</option>
</select>
Also I do not use the multiple optional attribute. Any idea why does the generated HTML contain "multiple="multiple" ?
Just a guess, but since you mapped it on roles, and since roles is probably a collection, it makes sense to make the select box multiple. If it was not multiple, you would only be able to store a single item in the collection. And the tag would not be able to display the selected roles.
EDIT: after reading the source code of the tag, it appears my guess was right. See the forceMultiple() method in SelectTag.

Resources