Count Checkboxes with Gravity Forms - wordpress

I'm making a form that is for a summer camp registration form where users will be registering. By the end of the form there is an option of paying in full or making a $50 deposit for each camp selected. I'm using hidden products to handle the total amount per week and adding their value into the total. My question comes if I can use formulas to count the number of checkboxes that have been selected and do the calculations.
Example:
Week 1:
Soccer camp
Week 2:
Computer camp
Total: $100 (Deposit)

I actually have a snippet for this:
https://gist.github.com/spivurno/077fd21a993e9b573d46
Updated: https://gist.github.com/spivurno/a14ef4a18f57d0c67811e1b4d8791781
The parameters are:
form_id the ID of the form for which you would like to count the checkboxes
count_field_id the ID of the field into which you would like to populate the checkbox count (you can then use this field's merge tag in a Calculation formula)
checkbox_field_ids an array of Checkbox field IDs whose checkboxes should count towards the checkbox count (when checked)

Related

Gravity Forms - Conditional Result

I have a GF with 3 products at a set price. However, if the user purchases more than one, there's a $50 discount on each additional item.
EX: Product 1 = $500
User buys 2 items, $500 + $450 (total = $950). Is there a way to do this with native (or plugin) conditional logic?
The only way I know how to do this natively is to create an extra Product field that adds as a "base" fee. In your case, that fee would be $50. Then your product price would be $450 all the time. Use conditional logic to "show" the base fee when only 1 item is ordered and to "hide" the base fee when more than 1 item is ordered.

How to know what record I am in? Dynamics AX7

Here is the scenario:
In the Sales and marketing > Sales orders > All sales orders
I entered the lines by double-clicking the Sales order number
by doing that I am entering the lines of the sales order.
Now in my lines, there is a button there where I will use to add a syntax where I will insert fields in my newly created table.
I would like to know how can I know what record I am in (before entering the lines/before double-clicking the sales order number). I need to know what Sales order number I'm in as I enter the lines of the record.
In every form the current record of a specific FormDataSource has the same name of the FormDataSource. For example in the SalesTableListPage form the only datasource is called "SalesTable", so the current sales order record is identified in your code with the salesTable identifier.
Every record is extended from [Common]. There you have field TableId. You can get table name with [tableId2name].
You can inspect fields with DictTable and field* methods.

Crystal reports, get sum for specific reocrds

In Short:
I need to get a total for customer groups + the credits - the debits in a specific date range.
In Detail:
I'm creating an invoice report for customer orders. Each Customer belongs to a group, and I need to group the invoice by customer group so I can give a total amount owed for the customer group.
So the top Group in the report is customers.group_name with the total for the group in the group header.
The second group is orders.customer_id with the total for the customer in the group header.
I have 2 parameter for the date range of orders which I use in the select expert
I have another table for credits and debits for each group.
This are the fields for the CreditDebits Table
group_name
date_
type_ (this can be either "credit" or "debit")
amount
I've linked customers.group_name with CreditsDebits.group_name in the database expert.
I also use the date range parameters for this table
Do get the credits I created a formula called "credists" like so
if {Credits_Debits.type} = "credit" then sum({Credits_Debits.amount})
But when I drop this formula on the customers.group_name header, the formula shows up as empty and the total for the group gets messed up (it becomes triple of what it should be.
What am I doing wrong?
First check Does this field CreditsDebits.group_name consists of customer name? or any different name?
Place the formula if {Credits_Debits.type} = "credit" then sum({Credits_Debits.amount}) in footer but not in header and check.

Adding Quantity Change to Drop Down Menu

I am trying to make a pay now button for a registration form online. Each individual has two options for payment. If they are a member, they can pick and pay the member's rate for registering for this event. If they are not members, they will pick the public's rate option for it. That's fine. It works great and it will ask them to either pay the member rate or public rate.
My question is, I would like to add another drop down button which would allow them to change the quantity of tickets they buy to this event. So if they want to but 6 tickets, they select 6. And if they are not members, in the next drop down box, they select Public.
I can add the second drop down menu, but it doesn't affect pricing at all, doesn't change the quantity.
Any help?
If the price of each quantity is arbitrary, this can only be done with custom javascript.
Do your prices and quantities scale linearly? I.e. 1 for $10, 2 for $20, 3 for $30, 4 for $40 -- if so, you can use Add to Cart / Shopping Cart Buttons to handle the quantities.
Another potential hack is to multiply your current dropdown's number of entries with the number of your second menu.
General Public 1 ticket - $15
General PUblic 2 tickets - $25
Members Only 1 ticket - $10
Members Only 2 tickets - $20
Another way is to use 2 separate buttons, one listing the member rates and one listing the public rates. This might actually be the good-enough path of least resistance.

link two fields select type symfony2

i work with Symfony2 and I want to see how I can use Form Events to link two fields select type.
The first field contains the cities and the second contains the country.
here is my entities:
user
- id
- name
- IdCity
city
- id
- CityName
- IdCountry
country
- id
- countryName
And thank you.
Solution #1
( working without javascript , enhanced with javascript, no reload required, small city amounts )
Create one select field of entity field-type displaying all cities and use group_by to group by country.
hide your single grouped select field with javascript ( type="hidden" )
split the select fields with JavaScript into a country field for the groups and add a second one for cities
change the city field if the country fires onchange event
change the hidden field if the city field fires onchange event
This way you are saving the code necessary to create a second form, inject your current country, filter with a second queryBuilder ... If you do have a lot of cities ( even with a cached result you are outputing too many )... go for solution #2.
Solution #2
( huge amount of cities, therefore loading cities filtered by country selection required )
create a form with an entity field type for the countries
pass the currently selected country into your form - default to null ( i.e. from your action or inject the request and read it from there)
create a subform of entity field type for the cities
if the selected country read from request is null - don't add the subform to the builder
if present -> add the subform and use the queryBuilder city field-type to filter the cities by country
enhance by AJAX-loading the subform on country-select
Hope you get the idea :)

Resources