Dynamic list for MailChimp checkboxes - mailchimp

I have a newsletter sign up form on my website that presents the user with a list of checkboxes to select. The checkboxes are generated dynamically from my database. Other standards newsletter sign up fields, such as email, name, phone number, address, etc. exist in the sign up form, as well.
In MailChimp, I have created a List and have added custom fields to match my sign up form (e.g. phone number, address). I then looked at the Embedded Forms -> Naked to see the generated markup. It's easy enough to set the name attributes of the text fields on my sign up form to match those in MailChimp's.
The struggle for me now is the checkboxes. I cannot put the list of items for the checkboxes in MailChimp as they need to be dynamically generated from my database. I have added a checkbox field in MailChimp to see what name attribute it generates in hopes I could use it in my form; I see something like this:
<input id="mce-group[15757]-15757-0" name="group[15757][1]" type="checkbox" value="1">
In my sign up form, I tried something like this:
<input name="group[15757][]" type="checkbox" value="Apple">
When I signed up, "Apple" was not carried over.
How do I capture checkbox items from my signup form into MailChimp?

It looks like you're using interests -- you won't be able to pass custom values to those, as they are simply yes or no. You'd probably be better off using a merge field. Alternately, you can create the interests dynamically, but you'll need to write a script to do that, you won't be able to use the form builder directly.

Related

Is there any reason that two Advanced PDF forms for the same transaction would draw data differently?

I have an Advanced PDF Form in Netsuite that prints Sales Proposals with pictures, and also an Order Acknowledgement. The code is very similar. Recently we decided to add them to the Picking Ticket, and I basically copied and pasted what I had on the Order Ack - because the data for both comes from the Sales Order in Netsuite.
For some reason the images just won't show on the picking ticket. I have tried changing the source code slightly, like using record.item etc., but the table starts with <#list record.item as item> so I shouldn't need that.
<td colspan="7" line-height="150%" style="vertical-align:top;">
<#if item.custcol_item_image_url?starts_with("http")>
<img src="${item.custcol_item_image_url}" style="height:40px;width:40px;margin:1px" />
</#if></td>
Basically I'm just getting a blank. FYI I also have another field that references from the Sales Order in the same way, ie. ${item.custcol_xyz} and that one works. Any ideas?
The custom field needs to be set to "show" on the Sales Order form in order for it to be available in your template. Customize your form, and under the Sublist Fields subtab, ensure that the field is question is checked to display on the form.
If you want to hide it in the UI, there is a workaround that you can try, which is to clear the label for the field. This works most of the time, but not always.

Rails: disable input tag upon selection from a dropdown menu

Scenario/Context
I've got a drop down menu with two input elements underneath.
From the dropdown menu, are names of companies (with values set to the respective company id's), and another prompt to Add a new company.
If the option to Add a new company is selected from the dropdown, then the user is to fill out the 2 input field elements (i.e. company name and company email).
Otherwise, if an available company is selected from the dropdown,
then the 2 input fields (for company name and email are to be disabled).
My question
Is this possible to do without an AJAX call if I want things to happen without a page refresh?
Can anyone suggest some other alternatives??
Many thanks!
That is absolutely possible, though you'd need to use some JavaScript to make it happen and load a bit more data to the DOM on the initial page load.
For each option in your company select dropdown, add a data attribute for the name and email.
Then, watch that dropdown for the change event in JavaScript. Whenever that event is fired, if the data-company-name and data-company-email attributes are defined for the selected option, disable the input fields and populate them with those values. If those data attributes are not defined for the option (likely only for your 'Add a new company' option), then clear the values from the input fields and enable them.

Kentico 9: Customizing the Form action based on the page the form is on

I have a form that I want to include on each of 250 pages based on the same pageType. Thus I want to include the form reference in the template and have it render on all pages. this much seems to be working.
However, I want to have the form to trigger an email send to a different email address based on the pages contactEmail property (entered as a property of the page/ defined on the pageType)
I am guessing I will have to build a custom form control or alternative form, but I don't know where to start and I have been pouring over the documentation for days.
I tried enabling email notification and setting {% CurrentDocument.ContactEmail #%} as the recipient email, but that does not seem to work.
I am not sure what context I can use macros in the form building or if there is a way to reference the current document field values within the form.
CurrentDocument is not available when sending an email, but it is when saving a form. As a workaround I'd suggest you adding a new field to your form e.g. ContactEmail and setting {% CurrentDocument.ContactEmail #%} as a default value for it. Now you need to make sure fields is on the page, but hidden with CSS - use a custom layout or an alternative form.
Now when saving form data, the system will save CurrentDocument.ContactEmail value along with form.
The last step would be updating To field under Email Notification tab of the form with following macro {% ContactEmail %}.

Multiple submit buttons with unique ids

In my application, I am trying to create a form that has some text fields and a collection of attachments. The user will have the ability to load an existing form from the database, and edit the fields and also add/remove individual attachments from the attachment collection.
For this purpose, in my view I have a foreach loop that renders the attachment details (id, name) AND also a submit button to remove the attachment. There is also a main submit button at the bottom of the form that the user can click once they have finished editing the form.
I have followed this solution to implement multiple submit buttons in my form. However the problem I have is when the user wants to remove an attachment, I would need to pass the attachment ID as a parameter to the "RemoveAttachment" action when the user clicks the submit button next to the attachment. But as it is, the application passes the main form ID to the RemoveAttachment action. Is there a way to pass the attachment ID when the user clicks the button?
Many thanks
Using a little javascript, first add a hidden field to your form:
<input type="hidden" name="attachmentID" id="attachmentID">
Then, on each of the submit buttons:
<input type="submit" onclick="document.getElementById('attachmentID').value='#ATTACHMENT_ID'" />
Of course, you replace ATTACHMENT_ID with whatever variable contains the id.
You can make a separate <form> for each remove button, with a hidden input (or URL parameter) specifying the ID.
Beware that <form>s cannot be nested.

textbox autosuggest in asp vb

The application is written in ASP VB classic and various Java scripts. I am faced with some issues
1) When I select an entry in a dropdown box, I can use the "onBlur" method to do what is needed at that point
What is the method available for an AutoSuggest Textbox that I can employ once
a) The desired entry is selected from the list (such as "onSelect").
b) The user never selects, but actually types the entire selection manually. In that case, I would need a method such as "onBeingDoneTyping"
2) When a regular dropdown is defined, I can display a user friendly description (like first and last name). In the meantime, internally I can retrieve what the index of that record is with the first entry of the parameter "value", in my case: PatientID.
" " " <%=lsSelected%> ><%=PatientName%>
How can that be accomplished when using the AutoSuggest feature in a textBox?
Say I allow "First-Name Last-Name"
Is there a hidden parameter that can be used that would let me know the index of the selected entry?
In addition, should I create a column in the data base "FirstLastName" to speed up the search?
For (1) you're after an auto-complete function. I've used this jQuery with classic-ASP a few times (excellent little plugin): http://docs.jquery.com/Plugins/Autocomplete - there's a good demo and example source there.
For (2) - assuming that you're using the jQuery plugin, then your object is a textbox, not a select object. So if the textbox you created is:
<input type="text" name="example" id="example" />
when the form is submitted any request.form("example") will return the text entered, not the index/selected value from any list of options.

Resources