Gravity Forms: Dynamic creation of fields - gravity-forms-plugin

I see a lot of discussion about dynamically populating fields, but not much of any about dynamically creating fields. I have what appears to be a simple form. It consists of an arbitrary number of questions with a set of possible choices. For example:
Which of the following would you choose?
o Choice #1
o Choice #2
+----------+ +----------+
| BACK | | NEXT |
+----------+ +----------+
The form would require a radio button to be selected, the NEXT button becomes active and the user proceeds to the next question.
There are dozens of questions with each question on its own page of a multi page form. It's a lot of configuration within Gravity Forms. Since each page will be identical in layout and functionality I am wondering if there is a suggested way of outputting this form dynamically.
Is there a way of creating form fields dynamically from within a hook/action in functions.php?
The reason I am asking is to explore the possibility of wrapping a Gravity Forms shortcode with one that allows configuration of the questions and answers.

The gform_pre_render filter is called on every form page load. You can manipulate the $form['fields'] to add/remove/modify the form's fields. This includes adding pages and fields on the fly (pages are just a field with the type "page").

Related

If it's possible, is there an option or other way to change a "Sublist Field" column's display type within a transaction form in NetSuite?

I need to change two columns in a Sales Order's item line section (bottom of the page) in NetSuite: https://i.ibb.co/27vx9Dr/2019-06-20-10-41-13-Window.png
It feels like the solution ties these two together as they are both perceived as item line fields or "Sublist Fields" (according to NetSuite's customization form page).
INVENTORY DETAIL needs to be enabled or set to "normal" so I can be able to specify bins associated from my selected item or be able to interact and fill in this column at the basic level.
AMOUNT needs to be set as "inline-text" so that other people handling sales orders cannot disturb it at all and still be able to see the value of this particular column.
I have attempted to search through Customization > Lists, Records & Fields and searched the following options: (which I thought were relevant to the fields that I wanted to modify)
Item Fields to no success
Transaction Body Fields to no success
Transaction Line Fields found out that AMOUNT and INVENTORY DETAIL are both padlocked
I also attempted to search through Customization > Forms and I have spent a long time looking through my Sales Order custom transaction form (possibly missing out on menus unintentionally) to no success.
I know that inside Customization > Forms > Entry Forms there is an Inventory Detail form in there that shows exactly the window I'm expecting, but I haven't figured out how to customise anything in the columns item line for transaction forms yet so I can create a custom column containing a link to INVENTORY DETAIL simulating the typical behavior of the original one while hiding the disabled one.
Near the top of a Sales Order form, I went to Customise > Customise Form and found out that I can find both AMOUNT and INVENTORY DETAIL inside the Sublist Fields tab.
Unfortunately, it only has SHOW toggles and this does not do what I need for it to do.
It is clear that I am confusing Sublist Fields with Screen Fields where I expected there would typically be a DISPLAY TYPE column that bears the drop-down selections containing "Normal", "Inline-Text" and "Disabled" options.
In actuality, they have SHOW checkbox toggles for both INVENTORY DETAIL and AMOUNT where the AMOUNT checkbox is greyed out. (This still does not achieve or reflect what I need it to do)
I am unaware of the conditions that needs to be met for AMOUNT to behave as an inline-text. There is probably another condition that needs to be met for the INVENTORY DETAIL column to be made available somehow.
I admit that I missed something crucial, so please kindly mention about it.
Any help would be greatly appreciated.
I was able to create a new column by creating a Transaction Line Field that contains two separate fields which are applied to Sales Orders.
For the INVENTORY DETAIL, I went to Customization > Entry Forms and copied the link for "Standard Inventory Detail Form" and then produced my own HTML code inside the Default Value when creating a new Transaction Line Field.
For AMOUNT, I created a new transaction line field and then set the Default Value as the appropriate value found in https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2018_1/schema/record/billingaccount.html and I used the curly bracket notation {} to fetch the data for the edittable AMOUNT but changed the Access to View-only, which makes this exactly what I needed.
After previewing the changes into an existing Sales Order, I can see my results reflected as expected. Consider this question solved.

Deleting invisible/unused input fields in Orbeon form

We have the following situation:
We have one form (we’ll call it “first form” for easier reference) which, among other things, contains dropdown select-box from which the user has to select a number from 1 to 10. Based on the number the user has selected (e.g. 5), on the separate form - on a different page (we’ll call it “second form”) we show that many number of sections as visible (5 new sections in our example). For each of the 10 sections we have defined visibility condition through XPath expression which returns true or false based on the number the user has selected from the first form. Now, because second form contains all 10 sections it shows all of them in the DOM, but in our example only 5 are visible on the front end.
So the question is: Is it possible to have the 5 additional sections not render in the DOM structure at all and if it is, how to achieve this?

With Gravity Forms, how do I make a form entry count as 2 entries based on a boolean?

I'm working on an event registration form with Gravity Forms. The event needs to be limited to X amount of registrants. Gravity Forms gives us this ability under the "Form Settings > Restrictions > Limit Number of Entries" section. As expected, each form filled out counts as 1 entry.
However, this form also has a "Bringing a Guest?" boolean (Yes or No radio buttons). If "Yes" is selected, I would like the form submission to count as 2 entries. How can this be done?
Rather than using Gravity Forms built-in entry limits, you might consider using a snippet I wrote which adds support for inventory to your Gravity Forms fields. More details on the other side of this link:
http://gravitywiz.com/better-inventory-with-gravity-forms/

Gravity form show form dynamically

my question I'm sure is a simple one but one that I am completely stumped on.
I have 4 gravity forms say, ID1, ID2, ID3, ID4.
I want the user to select from a dropdown which area they want. There are 4 areas. So if they choose Area 1 in the drop down,I want gravity form ID1 to load dynamically below the drop down.
If they choose area 2, then gravity form with ID2 loads etc. You get the picture.
Is there a very simple solution to this please?
Thanks
Depending on what your forms are - I would simply make one form with the 4 forms in it that display VIA conditional logic. The first thing (and only thing) you see is a drop down to choose options ID1 to ID4 and then based on that selection the conditional logic allows the parts of that form to be displayed.

VFP - Control report from form

iam using VFP 9.0...Iam making an invoice report, what i want to know is how to change the contents of the report by changing lets say a combo box in a form. or be able to use select and where clause in the report...any help would be appreciated :)
EDITED FOR CLARIFICATION (per comments instead of direct add into question)
+-----------------+ +-------------------------+
| Contract Form | | Invoice Form |
| | | |
| | | radioCustomer |
| btnInvoiceForm -------> | comboCustomersList |
+-----------------+ | radioContract |
| comboContractsList |
| |
| btnPreviewReport |
+-------------------------+
If I click on the Preview Invoice button, show all records from contract table where customer id (FK) is = to the id picked from the combo box.
If I picked contract from the radio buttons, the contract combo box would work, showing a list of contract id(s), running the report then would show you the record from the contract table where contract id = the id picked from the combo box...
I've edited the message to hopefully better understand your layout of the form(s) with respective radio button combobox controls respectively enabled/disabled. I think you'll need to draw up two distinct reports no matter what showing respective content, then call each one based on the radio button setting... Such as in the "btnPreviewReport" object CLICK event... I've roughed-in on the sample...
if not empty( Thisform.radioControl.radioCustomer.Value )
*/ Customer radio button was selected
xCustomerID = comboCustomersList.Value
*/ Run your Query
select ... from YourTable where ... into cursor C_SampleCustomerData
*/ Run the report
report form YourCustomerReport preview
else
*/ Contract radio button was selected
*/ Customer radio button was selected
xContractID = comboContractsList.Value
*/ Run your Query
select ... from YourTable where ... into cursor C_SampleContractData
*/ Run the report
report form YourContractReport preview
endif
Again, I tried the form as best from your description.
EDIT -- second comment clarification...
The nice thing about reports in VFP is they do not pre-require any hard DBF() in the data environment. However, it would be good to have your data fields set to an Alias.Field reference you are EXPECTING to have. So, if your querying of the data for the Customer report should always have the same expected alias result...
ex:
// pre-close in case the alias we want was already left open previously
use in select( "C_CustomerResults" )
select c1.*;
from YourCustomerTable c1;
where c1.ID = SomeChosenID;
into cursor C_CustomerResults readwrite
Then, in your report, have all your fields to something like
C_CustomerResults.FirstName
C_CustomerResults.LastName
C_CustomerResults.OtherField
This example uses an otherwise long alias name but just for clarification of handling.
I would do a similar for your "contract" results alias. As long as that alias is in use, the report will run against whatever is the current table in use. Nothing fancy, no other prep, no data environment settings needed in the report...
By pre-querying a sample of the data you would have in the report can help you in "roughing" the layout of your report. Then, finish your form to run the query and show the report and you're done.
EDIT -- revised comment follow-up again
Yes... for your customer invoice with multiple lines, same thing... however your report has a header band for things you want to only show once at the top of the page, and a detail band where you would want to show content for your "each line item" of the invoice, and a report footer to show any totals. Depending on complexity, you can add additional "Data Groups" in the report, but start with this now. It sounds like you need to get your feet wet with something working first before you expand on it.
If VFP is your development platform, another website that has dedicated experts in VFP all the time is at www.UniversalThread.com. They also support other forums, but in VFP, they'll get 100+ questions thrown at it a day...