RackForms v7.8.8
file upload
Site Tag Line
Latest Release: Build 958 - Arpil 18th, 2023
Contact Us  Purchase Options Purchase Options Contact Us
header-image


 
Top Link
Text File Upload


In Brief: Form users can upload file's through your form.

Dependencies: none.

Hints & Tricks: You can easily send file upload items to a Email module for attachment. To do so, you simply need to check the Send to Database / Temporary Storage checkbox for that file item.

IIS Users - By default, IIS prevents large files from being uploaded (4MB for II6 and 28.6 for IIS 7). Failing to address this issue will result in CONTENT_LENGTH_TOO_LARGE errors. To allow larger uploads, we need to do one of three things:

1. Modify the maxAllowedContentLength property in web.config.
2. Edit request filtering in IIS Manager
3. Edit the ApplicationHost.config file.

Please see this link for a detailed description of each method.

Mobile Image Uploads: For best results with mobile image uploads, try the combination of:
Upload Method: Multi-File
Max Image Width: A number less than 1200.

Options/Properties

Basic Attributes

HTML 5 Type (text input fields only)

This field, which default to text, allows us to set specific input type values for this field. At the most basic level, setting a type will enable browser based validation, and possibly create extra input controls for the field.

Browser Validation:

While we have a full validation system available to us in RackForms, in recent years browser vendors have taken steps to implement some of the most common validation steps within the browser itself. The Email field is a good example of this, when set the browser will check the validity of the input against common email patterns. If this field is found invalid the browser automatically applies a OS/Browser specific style to the invalid field.

Extra Input Controls

Generally speaking, adding extra input controls such as calendars and color pickers meant downloading and implementing a third party JavaScript solution. With the new HTML 5 controls this work is now implemented directly in the browser. A good example of this is the Date type, when set in some browsers a calendar item appears next to the field.

Considerations

It's very important to note these controls and their implementations vary wildly across browsers and OS's, and even then, not consistently across the same browser over different OS's.

For a current compatibility list please see: W3 Schools.

The good news is if an input type isn't supported the browser simply renders a standard text box.

Label

Type the text you want to appear above or to the side of the form element. This is also the value of the text displayed in the RackForms Result Browser and Email messages.

The label field supports local PHP variables if they are wrapped in PHP tags and echo'd out as: <?php echo $val; ?>

Please note that only local variables are supported, $_SESSION variables must be bound to local variables in the PHP Top Code or PHP Head Code section first.

As of Build 693 the functionality of this item has been expanded to support dynamic tokens for E-Commerce items. Please see the in-editor tooltip (located just above this field), for specifics.

As of Build 701, this field now also accepts the standard RackForms 2 token set for form field labels. Please see the in-app tooltip for exact values to use.

As of Build 705, this field now accepts the standard RackForms 2 token set for Section/Headline Text and Body Copy elements. That is, we used to only be able to use the @{value} token, as can now use F{}, S{} and so on.

The 'new' tokens will, by default, transform linebreaks into HTML br tags. This is very handy when we want to display a text area to a user where such line breaks have been added. This ensures the typed value matches, as closely as possible, the display.

Also in Build 705 is the 'raw' field token: FR{field_name}. This token was created because by default, when we use a F{} token for say, text1, we are actually creating the following code:

<?php if(isset($_SESSION['qs']["{$_SESSION['entry_key']}"]['text1'])) { echo "{$_SESSION['qs']["{$_SESSION['entry_key']}"]['text1']}"; }?>

That is, a full (but inline) PHP block. This makes it impossible to create custom logic in a Body Copy or Section Text block, as the open and close PHP blocks break any such custom code.

Thus, the raw token only places the raw field value into the text data, nothing more. The same text1 item now looks like:

$_SESSION['qs']["{$_SESSION['entry_key']}"]['text1']

That is, no PHP block, and no isset().This means we could, for example, create the following logic in a Body Copy element:

<?php
if(isset(FR{text1}) && FR{text1} != "") { ?>
I want to hide this Bodycopy if @{text1} is empty ?
<?php } ?>

Tail Text
Tail Text allows us to add text just after a text field element. Generally speaking this is useful for adding definitions to the data being entered, such as lbs, psi, and so on.

The content in this item is enclosed in a span with a class of tailtext, and is thus best used for small images and blocks of simple text.

By default the text container is defined in formpage.css with a rule of:

.tailtext { font-size: 75%; }

This means the text will usually be smaller than the label field by a small amount. However, we can certainly add our own html and inline styles to this element for a more custom look.

Name/Value

This element is set by RackForms automatically, though it is recommended to change this value if you decide to display Javascript validation messages, as the 'identifying' text of the error is the value of this field.

This value is displayed by default if no 'Label' attribute is assigned to the element. For technical users, this element name is in fact the same as the Name/Value html form attribute of this element.

You will also notice that if you change the name of this field, the id attribute to the immediate right of this element also updates with the same value. This is because in most cases you should keep the same value for both elements--however, you can use a different value, simply type in the id field separately.

Naming Convention Note: The only valid punctuation for the Name/Value and id fields is the underscore _. Use of any other character will cause the form to fail.

This is an incredibly important item for the Email+ and SQL+ Modules. The value you type into this box is what you will use to retrieve the dynamic value of the field at runtime. This element is often referred to as {field_id} in the documentation of those modules


id

By default is assigned the same value as the Name/Value element, though you can change this to a more field specific value. Not necessary for most applications. For technical users, this is the id attribute of the field item.

Wrapper Class Name

Every field element in RackForms is wrapped in either a LI or DIV element for Sortable or Free Form page types, respectively. When you place a value in this box it becomes the class="" attribute for that wrapper. Because a wrapper encompass both the input element and wrapper, you can use this value to show and hide sections of your form.

Helper Text

This text displays on the bottom of the field item. By default, the text is 7pt and light grey #888888. You can change the elements color in the RackForms editor, but the font size must be changed in the jobs formpage.css file.

Default Value
[Only used with text element such as text box and text area]
Any pre-assigned values for this element should be typed into this box. At run-time this value is automatically populated into the field item.

Please note this area can contain a mix of tokens and standard text. This means we can have:

F{name}-entry

...and any non-token characters, in this case: -entry, will be included as well. Pay special attention to spaces, as they will be rendered along with any tokens!

There are a few special considerations with using PHP variables in this field:

1. Always wrap the full variable in braces.

2. You cannot execute functions in this block, only variables.

3. $_SESSION variables must use single quotes as in {$_SESSION['variable']}, not double quotes as in {$_SESSION["variable"]}

4. All variables are passed through htmlentities($variable, ENT_COMPAT), which means any double quotes are turned into &quot;

Placeholder Text

This value appear within a text box field item.

Tail Text

This value appears just after the form field input element of a text field item.

Field Width

In pixels units, the height of the field item. Default of 140 for text boxes and 200 for text areas.

Please note that File Items do not use pixels but rather the html size="" attribute. This means we want to be careful when changing these values, as inputting a value that makes sense for text boxes, such as 200, will be massive for file items.

Field Height

The height of the field, in pixels.

Apply To All Items - Both Field Width and Field Height have this convenience shortcut that when clicked, will make all other items on that form page the same width or height as the current item. This is very handy when we want to quickly apply the same look to all elements on that page.

TinyMCE Editor
[Text area only]

Select from three TinyMCE preset configurations:
Simple Editor - Provides basic text controls.
Text Heavy - Provides ~13 text editing tools plus a slew of editing control such as undo.
FromBoss Style - Creates the same suit of text editing tools used in the RackForms Editor.

* Please be aware that at this time the Display Field Count validation property has no effect on text areas that use TinyMCE. You can still set a maximum character count, but this value will only be validated at the time of the forms submission via PHP, not JavaScript.

** You can only use 1 style of TinyMCE text editor per form page. The text area that comes first in the form will determine which TinyMCE text editor configuration is used.

Readonly

When set this field can contain a value and will submit data when the user clicks the submit button, but its value cannot be changed by the user. Please note this value can still be changed by manually editing the field in a JavaScript/Web debugger, so please be sure to not place sensitive information that cannot be changed in this field.

Field Enabled

When Yes the field accepts values and input from the user. When set to No the field ignores user input, and its value is not submitted with the form data.

User Provided Value Populates Field

When Yes the field populates with values set by the user after a page load. When set to No the field never displays values set by the user accross page loads.

While a bit strange sounding at first, "why would we not want to show a value set by the user", this has very  useful benefits for more advanced forms, particularity ones that perform data lookups. Say we have a form where we ask the user to input an invoice number for an inventory lookup system. We  never actually submit the invoice number, we just care about using that field as a lookup. The problem is when we leave the lookup page and come back, this field would now be populated with  the previous query's value. Thus, setting this option so the field doesn't remember the value  can be very useful when we want to keep our UI clean. 

Extra Attribute(s), JS, Event Code, etc

Although similar to a submit button, a button has an html type of 'button', not type=submit, which means when this element is clicked on, your form will not be submitted, but rather you must supply the event to occur.

A common use of this type of element would be to attach a history command such as onclick="history.back()", and then use it on a multi-form page to make navigating back one page easier than using text links.

Add code to your field item by typing it into this box. Code can be JavaScript event code such as:

onclick="alert('Be sure to use Letters only');"

External Library dependent code as in: (Prototype/Scriptaculous example)

onclick="Effect.Fade(this, { duration:.2});"

What's important to note is that the code you create here effects the field element, not the container it sits in. To edit the field container, you need to reference the field name prefixed with 'fb_fld-', as in a text box with an ID of text1 would be referenced like:
fb_fld-text1

Extra Field Style Attributes

This field allows us to define extra style attributes for our form elements such as:

color:#cdcdcd;

It's important to consider that RackForms also applies style data, traditionally as:

font-size:12px; color:#444444; font-family:inherit; width:200px; height:70px;

In short, font properties and height/width are handled automatically via editor properties. Thus, this field is for specifying extra style attributes not handled by the RackForms UI.

This is especially useful for Bucket items, where any style data we apply will greatly enhance the look of a standard bucket, which by default has only size and position styles applied.

Conditional Processing

Conditional Processing Overview
The conditional processing capabilities of RackForms can be broken into two main categories:

Guided - In this mode we use all fields except the Custom Conditional Field Statement text area. That is to say, we use the RackForms user interface to select one element or wrapper to apply dynamic logic to. This could be considered the "easy" mode, in that we write no code to perform our dynamic logic. We simply tell RackForms the properties of the interaction we want and RackForms does the rest.

Custom Conditional Code - In this mode we use the Event Trigger property say which event calls the code we define in the Custom Conditional Field Statement box. This could be considered the more powerful but advanced mode, in that we write our own dynamic logic.

Of course with power comes flexibility, as in this mode we can apply any type of complex logic we need to get the job done. In particular though this code-centric mode is required if and when we want to apply dynamic logic to more than one field item or wrapper class item (items that have the same Wrapper Class property defined).

To be clear: if we only need to apply dynamic logic to one item or wrapper class we use the guided mode. If we need to have more than one item show or hide, we use the custom code mode.

Important Note
Starting with Build 759 we can use the Guided mode controls to apply conditional logic to items on a different page than the one the affecting form field is on.

Please note however, that this capability does not apply to Custom Conditional Code logic, only guided ones. That is, any custom conditional code we write only applies to items on the same page.

Field Initially Visible?

Determines if the form element is visible when the page first loads. Please note that this logic always resets on page load, that is, if a user goes back one page where an element was previously shown it will be invisible again .

This Form Field...

This field and the next allows us to create a condition on the visibility of the field. We enter the Name/Value of a form field in this box, and in the next, the value we check against. If the value matches, we show the field. Please note this only works as a method to show a field, not hide. That is, we still uncheck the Field initially Visible to hide the field, these options simply allow us to show the field based on a condition from another form field. Please note this logic works across pages.

Has This Value...

The value we check to determine a fields visibility. This must exactly match the value the form field will contain. This field is also dynamic, which means we can use standard RackForms tokens to check against a dynamic value at run-time.

Easy Toggle?

Checking this box means RackForms will automatically handle the logic needed to perform the opposite action you set in Then... and If This Field Is: properties. For example, if you set the action of an item to be 'Show', if the condition needed to make this show action happen is revoked, the opposite action will automatically happen for you. So, if the condition is the text '1' must be set in a text box in order to show a second text field, if this 1 is removed or changed, the second text box will be hidden again.

In general we want to keep this box checked, though if you wanted to force a field to always show after an action then leave it unchecked.

Event Trigger

This is the JavaScript event that will be scanned for and then acted upon if activated. Some events are better than others for the various tasks you have. For example, the onClick event is perfect for Checkboxes, whereas the onKeyUp event is perfect for text boxes where a user needs to enter a specific value. Experiment with these values and have fun!

Caution! You may run into a situation where you build a form that enables the event trigger on a specific field, then remove that field later on without updating the Event Trigger's 'binding' to that element.

If this happens your forms validation will break, along with other potential issues.

The solution is always make sure that when we enable an event trigger for an element, that field exists on the form.

Animation?

While not always needed, if you want you can add animation using Prototype JS to your events. The upside of this is your forms may have a more professional appearance, the downside is the extra bandwidth needed to send the Prototype JS library over the wire to run the animations. However, if you are already using animation or have included the Prototype JS library for other purposes, this bandwidth cost is obviously negated, so animate away!

If This Field Is:

This is the core property of the Conditional Processing logic. In most cases you will only want to show and hide fields if a specific condition is met, this option allows us to set that condition. As with the Event Trigger property, some options only make sense in the proper context. For example, the top Value Comparison grouping is best served in combination with text and select fields, whereas the Field State options of Checked and Unchecked only make sense for checkboxes.

It is also important to note that RackForms will attempt to cast comparison values set as INT and FLOAT values to their respective native types.

This Value...

When we set the If This Field is property, with the exception of the two Field State checks of Checked and unchecked, we typically want to compare against some value. It is in this text box that we set that comparison value. RackForms will automatically attempt to detect FLOAT and INT values when testing against GREATER THAN and LESS THAN checks.

Then:

If the condition set in If This Field Is and This Value... passes, this is the action we will perform. Please note that is Easy Toggle? is enabled, we will automatically perform the opposite when the check fails.

This Field Or...

When we set an event, comparison, and action, the last step is to tell RackForms which fields to act upon. It is in this field and is close relative, This Wrapper Class, that we set this field or fields.

As you build your form RackForms will automatically track the Name/Value properties of the elements on that form page and then present them to you in list format in this field. Thus, all eligible form fields will be displayed in this select item, the one you select will become the field acted upon.

Finally, any elements that are set to hidden on page load are tagged with a [H], which makes it easy in many cases to see which items you may need to work with.

Note that items from other pages will be shown as well, they are grouped with an entry of the page name they below too.

This Wrapper Class

Similar to the This Field Or... property, with the exception that instead of single field we can act upon all elements with the same Wrapper Class attribute. This makes it very easy to show and hide large portions of content with one action, perfect for address fields and the like.

Conditional Field Statement

Although RackForms tires to automate as much of the show/hide process as possible, their will be times when you need to have more complex logic. When this is the case, we can use the simple RackForms API to create custom logic.

The bulk of this logic will be derived from a JavaScript object called fbc. This object is defined in:

/rackforms-root/app/movefiles/conditional.js

This file is exported into the root of all RackForms jobs.

The basic usage of this object will depend on what action you want to perform. Their are 4 methods you need to know about:

hideField, hideWrapper, showField, showWrapper

As shown in the editor, we call these methods as:

fbc.showField(event, 'FieldName', 'animation');

With a simple example to show a text box being:

if(in_value == '1'){
  fbc.showField(event, 'text2'); // animation argument is optional, event and field name is not!
}

Simple enough--But it is important to understand that at the page code level RackForms creates two distinct but related items.

The first is the event trigger which is placed inline with your form element. Please be aware the event used is not created automatically, you need to select one from the Event Trigger select item.

Thus, if we select the onKeyUp event RackForms will place this code inline with your element:

onkeyup="fb_dyn_text1(event, this.value, this)"

Notice we have three arguments. This is important because the inline method call is directly tied to the second main element RackForms creates for you, which is a script tag with that methods definition.

This method looks like:

function fb_dyn_text1(event, in_value, elt){
  if(value == '1'){
     fbc.showField(event, 'text2');
  }
}

As you may now see, this method body is the code you create in the Custom Conditional Field Statement text area. The reason why it is wrapped in the method is to that you do not need to worry about creating or gathering the event, in_value, and elt parameters.

Thus, the last bit of knowledge to convey is that these parameters, event, in_value, and elt, can be used in any way you need in your Custom Conditional Code. Most of the time you will only need the in_value parameter for your logic, but please notice you must pass event to the fbc functions no matter what.

Custom Code Hints and Tricks

Place hide field calls at the top of the code section.

One common trick to employ to keep your code block clean is to place all hide calls at the top of your code block. This eliminates the need for most if/else blocks, and means we only need to set conditions to show elements. The reason this works is hiding and showing elements is so fast, that even if an item is shown and will not be hidden by the code, the hide call and subsequent show happens to fast to be perceived.

Be careful with integer values.

Integer and number values in JavaScript can often cause problems, as they may be interpreted as strings, and vice versa. Thus, when working with number values always pass them through isNaN (is not a number), and parseInt/float. For example, the following code will check to make sure k is a number, and is also an int.

var k = 10;

if(!isNaN(k)){ // is this a number?
  if(parseFloat(k) <= 10) { // parse and check value
   console.log(1);  
  } else {
    console.log(0);
  }
}

Watch which Event Trigger we use.

Generally speaking, a text box should use blur, a drop down onchange, and radio and checkbox items onclick. Using different events is possible, but can lead to unexpected results.

Callbacks

New in Build 711, we now have a callback that's fired after an animation plays:

animationDone(elt)

We use this callback inline with our Conditional Code block as in:

fbc.animationDone = function(elt){
  alert(elt.id);
  // when animation is done, call resize function for iframe
  window.parent.resizeSubForm(getOutputSize());
}

That is, we call fbc.animationDone(elt), then in that function, define the actions to take place.

The elt parameter is the object that called the animation, that is, is the object which reacted to the event.

Please note this event is fired for every animation that plays. Thus, if we've used this in the content of a Wrapper Class with say, 5 elements, this function is called 5 times.

Important RackForms Note: In RackForms 2 the in_value parameter was defined as just value. This caused code conflicts however, and was thus renamed to the present value. If importing any RackForms 2 jobs into RackForms, any custom code will need to be updated to use the new value.

Field Style Properties

Grab This Fields Style Properties
This shortcut button allows us to quickly store and then apply the current fields style properties to other fields.

When we press the button the cursor will turn into a crosshair. To apply the style settings to a new element simply mouse over the field and click.We can leave this mode at any time by pressing the Escape Key.

Element z-index

This seting allows us to set the z-index of most items. This property is reflected in the editor as well, making positioning items much more streamlines than in previous versions.

By default most items, with the exception of calendar fields, have a base index of 1. This means so long as your form fields to not overlap you will not need to set this property. However, some fields, such as images or those with popup's (like the calendar field), benefit from setting a different layering order.

Element Tab Index

This option allows us to set the tab index of the element in question. Care must be taken when we set a value however, as items like the Grid Element contain sub elements, and although a set value will tab to the first element of the Grid, if we have elements with a higher tab index after the Grid we'll immediately tab out of the Grid item.

As a general rule when we build forms the tab index is automatically decided by the browser based on document position. That is, the newest elements we create have a higher tab index. This is different than visual position, as if building a free form page the lowest element on the page may not be the newest created.

Thus, the tab index control helps us smooth out visual position and actual tab order by manually being able to set it.

Sometimes a better method however, is to switch a free form layout to sortable and position elements from top to bottom in the order we add them to form. Then we can switch back to free form and while the positions of our elements has been retained, the tab order will now reflect the proper document ordering.

That said, perhaps the most common place to set tab order manually is when we have a Layout Bucket or Survey. This is becuase In some cases a layout buckets items will be added after other sortable items have been added, which means a tab out of a bucket item places us out of the bucket and into the most recent item added.

Text Color

Click into the box to load the color selector. Drag your cursor over the saturation in the main box to select the color intensity, or drag the hue slider to change color.

Input Text Color

Set the input fields color.

Label Font Size (px/pt)

Type a number in this box to change the font size of the element. By default if no unit is specified (the field is just a number) RackForms will use px. We can use pt however, and this unit-type works much better with PDF output in some cases.

Label Font Weight

This option lets us set the font weight of the forms field label or main text block.

Option Font Size (px/pt)

Used only for Radio and Checkbox items, defined the items label font size.

Option Font Weight

Used only for Radio and Checkbox items, sets the weight of the individual radio or checkbox items label.

Field Spans Both Columns In Table Layout

New to build 704, when enabled this option lets the form element in question span both columns in a tablemode layout.

Notes: As of now the only fields to use this option are Section Text, Body Copy, Images, and Separators.

Field Width

This option sets the width of the Section Text or Body Copy elements. Please note this option is not used for any other elements.

Field Height

This option sets the height of the Section Text or Body Copy elements. Please note this option is not used for any other elements.

Border Radius

This CSS 3 feature applies rounded borders to the item. As this is CSS 3 only, IE versions lower than 9 will not be able to display them, though any recent version of Firefox, Chrome and Safari all will.

Item Text Alignment

This option sets the text alignment of the Section Text or Body Copy elements.

Enable Banner Mode

This mode is used to create banner like entities on our form page -- that is, elements that span the entire page width regardless of Page Padding settings. By banner we broadly mean a text display element that has a background color set and any type of content within.

It's key to note that this feature is only useful if we've got a full page form that uses page and form background colors. If we do not have this type of layout, it's almost always best to ignore this feature and just use the standard form padding controls.

If we do have a form that uses background colors, Banner Mode is needed because RackForms applies page padding to the form container. We can control this padding amount via the Form Style Properties > Page Padding control.

In theory we could set this value to 0 and then all text elements, if set to the proper width, would span the entire length of the form page. The issue is if we did all form elements will end up touching the edge of the form page, which of course includes all form elements.

As this is rarely what we want Banner Mode was added to selectively say "this element should span the entire form page, but leave everything else alone"

The end result from a technical standpoint is RackForms, when building the form, takes the page width and adds the page padding we've defined and makes that the new width of the element. It then take the page padding the applies that as negative margin to the element based on the Banner Mode Position setting. Thus, from a presentation standpoint the element now spans the width of the page, but our global page padding setting still holds for all other elements.

In light of this then it's important to note that enabling Banner Mode means the value we set for Field Width is ignored.

Banner Mode Position

This control, along with Enable Banner Mode, tells RackForms where our banner is on the page. If we set this to Top Banner RackForms will apply a negative left and negative top margin equal to the Page Padding value. The field height stays the same. This is of course used for banners we place at the very top of the page.

If we select Middle Banner we apply a negative left margin but not a vertical one. This means the element will span the entire page width, but not affect the items above and below it.

Finally, if we select Bottom Banner RackForms will change the field height of the element to be +21 pixels added to the page padding * 2 + half of the page's Sortable Item Bottom Margin value. In short, the field will get grow by about 69 pixels so that it touches the very bottom of the page.

All of these modes work best and are in fact designed for standard sortable page mode.

The key to this setting is to know that having a page-spanning banner in the middle of the page using the Top Banner setting will result in a banner that "smashes" into the field above it. Thus, we must make sure we set this property properly!

Banner Mode Hints & Limitations

Banner mode works well if we have just a top banner, or a top and bottom banner, but not if we have a bottom banner only. In short then, try and design your forms to not depend on a bottom banner only.

That said, this issue only becomes apparent if we've also enabled Apply Box Shadow. If we haven't we needn't worry about this issue.

Label Position (Form fields only)
Sets the position of the form field label, though the implementation depends on the form field type. Text items switch between being on top and inline, radio and checkbox items the same, only multiple items line up in a row as opposed to vertically. This is how we create survey type forms, for example.

Please note though that when using Inline, by default RackForms uses 100% width for all radio and checkbox items. This means a series of say, 5 radio options should show nicely on a sortable page. However, their will be times when we want to display radio items in columns, such as when we have many options, or when in free form layout mode.

If this is the case, we can always set a specific column width in pixels under: Select Item Options > Column Width

Input Inherits Font Size and Family

This field lets you set the input elements input font and size to match the label field.

Validation

It is very important to note that validation behavior is handled in two places: the field itself, and in the fields containing page properties. Within the field, you can control the elements listed below, such as whether the field is required, the minimum and maximum number of characters, and so on. Within the page properties, you control the style of error, whether messages are displayed, and other such properties. One way to think of it is error handling per field item, and global error handling properties. FIeld item properties are specific to that element, global effects all error properties of that page.

For example, the default behavior of a field that is marked as required is to, when filled in improperly, highlight the field with a color you choose in the Page Properties Form Error Color. In other words, you set the field as required in the elements field properties, but you control the color of the error highlight in page properties.

For more information on what properties you can edit, please see the Form Style Properties and Page Properties of the Sortable and Fee-Form Page types.

Required

Check this box to make this field a requirement for successful form submission.

Required Star Color: In some instances you will want to change the color of the required star. To do so you can use one of two techniques:

Technique 1. Permanent change: Navigate to the RackForms/app/movefiles/ folder and open the formpage.css file and look for the .req-star class definition. You can then change this color to fit your jobs needs. This change is permanent because every job you export will now use this style sheet file and definition.

Technique 2. Per Job Change: Click on the page header to bring up that page's attributes, then add the following style definition to the Page Javascript/CSS Code code area:

<style type="text/css">
  .req-star { color:#dedede; }
</style>

This will override the style definition in the RackForms.css file and use the color you specify.

Field Validation Method

This option allows us to set the behavior of how conditional items will be validated when hidden.

By default, when we set an item to be hidden and required RackForms will still process the invisible item as if it were shown to the user. With this new option we can override this behavior to tell RackForms that any item that's hidden and set with Field Only Validates When Visible should, as the option name states, only trigger validation errors when visible.

The trick with this is from a security standpoint it's possible to create a script that exploits this behavior such that no fields would be required. However, the RackForms implementation is such that only fields set with the property are able to be 'bypassed' via normal validation methods.

The end result then is if we're building a form that needs to have required fields, but those fields are hidden unless a user triggers a condition to show them, to enable this mode for that field, and of course any others that require it.

By default RackForms will still validate all fields unless told otherwise. This maximized security while providing a way to create smarter forms.

Min

The minimum number of characters this field must possess. Validates if the field is required or not.

New in Build 706, for checkboxes, this is the minimum number of items that must be checked for the field to be valid. To set a specific number, set the min and max values to the same value.

Max

The maximum number of characters this field can contain. Validates if the field is required or not. If you wish to limit the number of characters a user can type, specify that value in this field. The user will not be able to enter more characters specified by that value.

For checkboxes, this is the maximum number of items that can be checked.

Regex Validation Rule

This is the Regular Expression rule to apply to this field. Used in required fields only. Choose from No Rule, Custom Rule, and a series of preset rules.

If you choose Custom Rule, you will be given a 'Custom Regex' box to populate with your own expression (please note only one expression can run on each element).

For example, you could use this to validate $45.23:

^\$[0-9]+(\.[0-9][0-9])?$

or without the dollar sign as in 45.23:

^[0-9]+(\.[0-9][0-9])?$

Same As

[Only used for Text and password fields] If populated, this element and the one specified must match to validate. Only effective if the field is required (the must match field need not be specified as required). Effective for user password and email address validation.

Validation Error Message

Type a custom message for validation here, in the event you select a 'Regex Rule' for the field. All other validation messages are handled by RackForms.

Display Count Fields

[Only used for textarea elements] Select from No Counting, Words, or Characters. Select Words or Characters to display a Javascript based character/word counter at the base of your text area element. This item works in conjunction with the Max validation field, though if no value is set it defaults to 500 characters.

File Uploads

Upload Method

This option allows us to define the general appearance and behavior of the Upload module. This is an important option to set, as the behavior differences are quite stark.

The default option is Classic, and as the name suggests, presents the classic, single file upload control item to the user. The users can then select a single file for upload, which is then processed according to the options we set, such as file size restrictions, images processing, and so on. The big issue with this method is we cannot resize images upon selection, a severe problem when taking photos from a mobile device, as those images are often incredibly large.

Multi-File, by contrast, uses a completely different UI, allowing users to manage files uploads in real time. Critically, this method allows for multiple-file uploads from the same instance, as well as for resize before upload logic, critical for mobile forms that support image uploads. Being able to resize images before upload means mobile form users who take images with the camera phone can shrink them to a size most mobile networks will have a much easier (and faster) time handling.

There are several other considerations to note when using the Multi-File Method:

The Multi-File method requires the use Bootstrap UI, which means many items in your form, such as submit buttons and input fields, will be "taken over" with Bootstrap styling.

Multi-File Uploads and SQL+

We can use the Multi-File upload method with SQL+. The method is the same as any other SQL+ query.

We write a query to collect the fields you want from the upload, including the file data and optionally, file size, type, and so on. We then make sure to select this upload field in the SQL+ item's Process This Multi-File Upload Item field.

RackForms will then pull all files it finds for this control and upload the requested fields to the Database. It's very important to note this method is not appropriate if the SQL query is performing any task other then uploading files to a dedicated file data table. This is because if other fields were included, say, a customers address, that address data will be written to the database as many times as we have file uploads.

One common way to handle the use of multiple tables to handle a data entry is to use the ENTRYKEY keyword in your SQL Queries Variables block. This value is transformed into a unique key for every form submission started, which means when used on multiple tables across multiple SQL+ insert items, each table will have the same, unique value for each form submission. We can then issue SQL JOIN's to each of these related tables to collect all data from a single form submission.

Other considerations

The Multi-File Method supports drag and drop uploads.

It's usually best to combine the Multi-File method with the Entry Viewer submission item, and optionally flat file uploads.

Multi-File Uploader Method

This option controls how a Multi-File upload is initiated. When set to the default, Auto, users select files and they're automatically submitted for upload. This method requires the least amount of manual intervention from the user, and is especially well suited to mobile-first applications.

When in Manual mode, user select files and for each item added, must manually click an upload button to submit that file. This method is best suited for large file transfers.

Please note in both cases users are presented with the same after upload controls, which means we can remove and preview files at any time.

Maximum File Upload Size

Select the maximum file upload size you wish for this field. Choosing 'Server Maximum' will let RackForms query your PHP .ini upload_max_filesize for this value.

Please note that as of Build 693 we now display this and the post_max_size property value as currently set on the server. This is important because while we may provide a large enough value for each file upload via upload_max_filesize, the post_max_size property determines the total page data for the POST request, which if smaller than the total size of all page elements (including form fields and file upload slots), the upload will fail.

Thus, the simple rule is post_max_size should always be big enough to handle every upload on the page, as well as all form fields.

Both of these settings are found in your servers php.ini file. Because of this, any changes you need to make to these settings are best handled by contacting your web hosting provider.

Allowed File Types

All files will not distinguish between images and non-images, however, in the RackForms Result Browser all fields designated with this value will appear as file downloads.

HTML 5 Upload Options

These options allow us to use an HTML 5 drag and drop upload module instead of a traditional file dialog box. While convenient for many users, such a method does have drawbacks.

First, this is not a good method for mobile users, as it assumes a drag and drop environment consisting of a desktop and browser.

The other major consideration is while growing in popularity, such an upload method may still confuse or distract less experienced users.

Finally, it's important to note this method is handy as we can drag and drop multiple files on the upload area at once, though for all methods except Entry Viewer and Simple Email, we'll need to grammatically access the uploaded files via the Form Token element:

F{fb-html5-files}

This will provide a list of all files that have been uploaded successfully to the server. We can then iterate over this list with the code:

session_start();


$files = F{fb-html5-files}; 

$files = array_filter(explode('|', $files));

foreach($files as $file){

  $file_contents = $_SESSION['qs']["{$_SESSION['entry_key']}"]["$file"];

  echo $file_contents;

}

 

Of course this is an advanced technique, which is why for multiple file uploads it may be easier to use a standard form file upload item.

Use HTML5 Uploads?

If checked, the standard form file upload item will be replaced with a drag and drop HTML 5 version.

Show Image Preview?

If checked, any images we upload will update with a preview within the drag and drop uploader area.

Drop Zone Width

The width of the drag and drop zone.

Drop Zone Height

The height of the drag and drop zone.

Progress Message

The progress message shown to the user during an upload.

Complete Message

The message shown to the user after a file upload has finished.

HTML 5 Upload Instructions

The message displayed to the user describing how to activate the file upload process.

All Files

All file types will be allowed.

Images Only

This mode will check to make sure the uploaded file is on mime type's: pjpeg/jpeg/gif/png/wbmp

Files Only

Will prevent image files from being uploaded, makes sure no image mime types are passed through.

PDF Files Only

Will do a MIME check for PDF files and attempt to block all others.

Zip Files Only

Only allows the upload of zip files, which can be very handy for larger file uploads.

Office Files

This type allows the most common Microsoft Office file formats, include Word, Power Point, and Excel. In addition, we can also use PDF files and Comma Separated text files (.csv).

Save As A Flat File?

If checked, RackForms will save a copy of the uploaded file to your file system. Please note RackForms will automatically rename duplicate files, appending a dash (-) and the increment number to each file.

Please also note that if a file rename does occur, the SQL+ meta field _name will contain this new name, which means your database record and flat file system will remain in sync.

See Flat File Directory below for more information on where your flat files can and will be saved too.

Send To Entry Viewer (formerly known as Send To Database)?

If checked, a copy of the file will be sent to the RackForms Entry Viewer(if using a database module such as Entry Viewer) and temporary storage (basically a session variable). This will only work if you have a unique jobname set.

IMPORTANT: If you want to have files sent as email attachments you need to have this box checked for each item you want attached. Please see Confirmation Elements -> Email and Email+ for more information on this topic.

One very important rule you must follow when using this feature: Because this feature uses the RackForms database, you must be sure to:

a) be using a local copy of RackForms so you have access to the RackForms database tables or

b) if this job is destined for another server without the RackForms database, you'll need to install the RackForms Entry Viewer Standalone on that server.

Save For Email Attachment / Flat File Data?

When checked this item will be included in the list of files that can be attachments for your email items (modules), or as standard file upload item as defined in a Flat File module's Flat File Simple List data. We say can be because in order to have this file become an attachment to that email, we also need to make sure to check the 'Include file attachments?' option of the email confirmation item. The reason we do this is because it gives us an incredible amount of control over what gets attached in our forms. We can set an item to only get sent to the database, only get prepped as an email attachment, or any combination of the two that fits our jobs requirements.

Flat File Directory

If sending items to flat file, this will be the name of the directory used to save the files in. Defaults to 'upload', but any value you enter here will override this default value.

Please be aware that you only need to use the directory name if you want the file to be saved in the same directory as the job, for example, images would create and use a folder called /images. In other words, you do not need to add any slashes. However, a ./ will mean "current directory", a ../ means go up one directory, and so on. In any event, please keep in mind the root directory is the current jobs directory.

Append Value To File Name

If defined, this value will be appended to the end of the uploaded file name. This is very useful for times when we wish to tag images with a ID of some kind, such as product group or case number.

To ensure this field has maximum versatility, the append value can use standard RackForms tokens for a Form Field (F{}), and S{} for a SESSION values.

Important Notes:

Please note this feature always strips path values, such as ./ and ../.

Array values (such as what we get from a checkbox group), are grouped together with an underscore (_), and printed as a single string.

Finally, please note while we can use this feature with HTML 5 uploads, we cannot use F{} tokens if the form field resides on the same page as the HTML 5 upload item. If the upload item and form field we wish to grab a value from reside on the same page, we must not use the standard upload item. However, F tokens will work if the form field was defined and submitted on a previous page.

Max Image Width / Max Image Height

If set, all image's uploaded will be scaled down to this value if over. Values are in pixels.

Create Thumbnail?

Check this box to create thumbnails of uploaded images. Please note that thumbnails are created as flat-file and database-ready elements via the shortcut:

file_field_name_thumb

That is, the Name/Value of the file upload element, an underscore, and the word thumb. Please see SQL+ Integration for more details on using these shortcuts.

All thumbnails will be created using the naming convention thumb_{original_file_name}.xxx, and stored in the file upload directory of its parent job folder.

!IMPORTANT! Thumbnails are only created when Allowed File Types is set to Images Only.

Max Thumbnail Size

This is the maximum dimension in pixels you want the thumbnail to be. The widest dimension determines which axis the image will be scaled down in. For example, an images that is wider than it is tall will be scaled down by width.

Thumbnail Directory

Specify the directory you would like to have your thumbnails saved too. This can be as simple as thumb_images, which would create (if it doesn't already exist) a directory called thumb_images in that jobs folder and save all thumbs to that directory.

Please notice that you do not need to add a slash to the name if you want it saved in the same directory. You would however, need to use appropriate path nomenclature to save in other parts of your server, so long as you have permission to. For example, you could save one directory up with ../thumb_images.

DB Connector File

If you input an absolute path into this box, RackForms will use that file for all database connection information for this query.

SQL+ Integration

RackForms supports a variety of SQL+ enhancements to the File Field item.

For starters, all file upload fields are referenced with the same technique as any other field, that is, the field id inserted into a SQL+ statement will transfer that file upload item to your database per your SQL+ insert statement.

Second, all file fields are automatically tagged with three meta tags plus an optional _thumb data item for images:
_name
_mime
_size
_thumb (Image uploads only!)

These meta names are accessed in SQL+ insert statements by prefixing the _ meta name with the field id of that item. For example, a field called image could be used in an SQL plus statement in the following way. (This example assumes you have created a file upload field and assigned the item with an id of 'image', and also created a table on your database named 'result'):

SQL+ Code:

INSERT INTO result (image, image_name, image_mime, image_size) VALUES (?,?,?,?)

Variables:

image,image_name,image_mime,image_size

As you can see, the image field is the only item we have actually created in RackForms, the other three elements are created by RackForms, you just need to reference the meta values correctly to insert their values into your table.

As stated above, we also have one more meta item: _thumb. This field is only available to us if we have selected 'Image' from the Allowed File Type drop-down menu. To use this field, you would simply expand the query above to include the _thumb meta item:

SQL+ Code:


INSERT INTO result (image, image_thumb, image_name, image_mime, image_size) VALUES (?,?,?,?)

Variables:

image,image_thumb,image_name,image_mime,image_size

As you can see, by prefixing _thumb with the file upload field id, which in this case is image, we will upload the image to our database on form submission.

Processing Mutiple File Uploads For Database Consumption

RackForms can process multiple file uploads from a single form control. While the process is similar to inserting simple text data (which creates one database row per submission) their is a critical difference: a Multi-File form control can add multiple file items and hence, may add multiple rows to a database table per single form submission.

In other words the act of uploading multiple files creates a logic problem: If a standard (text-based) form submission creates a single row of data, how do we "relate" file upload items to each other and more importantly, back to a "parent" master record?

The answer is we first insert the parent record and from that act, receive a unique identifier to use as a key back to the parent table.

All that said it's key to note this relationship issue only happens if the files being uploaded need to tie back to a parent record! In some rare cases we may simply have a form that does nothing but upload files, in those cases we can just upload file data without concerning ourselves with relationships. These cases are rare however, hence the need to address the issue.

Thus, to correctly process Multi-File uploads then we perform the following steps:

1. First, ensure the form has at least one file upload item that's set with the: Upload Method > Multi-File or HTML 5 Upload Options > Use HTML5 Uploads. Then, set this field as the value for the Process This Multi-File Upload Item... drop down menu.

Note: if we do not set a value for the Process This Multi-File Upload Item field RackForms will simply upload the first, and only the first, file uploaded by the user.

2. Next, as discussed above we need to decide if the files being uploaded need to "relate" to non-file data. In most cases the answer is yes. We say these forms have related data.

The alternative is we do not have textual data, or, in very rare cases, the file uploads do not need to relate to anything. In these cases we say we do not have related data.

3. If our form has related data we must:

  • Ensure the parent table has a working auto-incrementing PK field.
  • Ensure the Using This Last Insert ID Return Variable... field is set to $ret_val.
  • Ensure the file upload field comes immediately after a textual (parent) SQL+ insert item that has the Set lastInsertId() = $ret_val option enabled.
These steps ensure the "key" needed to relate our text and file data comes from the insertion of the textual data into the database, aka, the parent record defines the master identity of all inserted items.

4. Finally, we must define the linking column name the file upload table uses to relate back to the textual data using the ...Mapping To This Database Column Name field.

Note: We cannot use any reserved SQL words for the value of the ...Mapping To This Database Column Name field.

The value used here will simply be the column name as defined in the database table where we'll save the file uploads to.

If we do not have related data we can simply clear any values from the Using This Last Insert ID Return Variable... and ...Mapping To This Database Column Name fields. In these cases RackForms will simply upload the file data using the SQL+ Insert statement you define without any further modification, just as it would for standard non-file data. However, unlike a standard submission it will still create one database row for each file, just not with any relationship data.

Flatfile Integration

Similar to the SQL+ integration, when using the FlatFile module to save data out to a file on your file system, you can use the following meta fields as a prefix to the field name:

_name
_mime
_size

For example, if you had a file element called file, you could retrieve the uploaded files mime type with:

file_mime

Builder Page Integration
You can build a form that saves flat files and then loads those flat files in a Builder Repeater page.

Assuming a file Name/Value of file_1, The most common technique for this would be to set your Flat File Directory to a folder one level up from the form with:

../upload_images

Then in the SQL+ Module, set the file column to the name of the file with:

INSERT INTO entries (file1_name) VALUES (?)

And this for variable values (this is a meta query, described above in SQL+ Integration):

file_1_name

And then in your Builder Repeater, create an image item, and set the fully qualified link to the file1_name database field with this as the images path:

http://domain.com/RackForms/output/forms/standings/#{file1_name}

Thus, you would now have images being uploaded to your server file system, a record of the file name in the database, and in the Builder Repeater token, a link between those two items in the form of the image link which looks in the folder of images for the image name saved in the file1_name database column.

Please see this forum thread for more on this topic.

Important Note For PostgreSQL Users:
Due to encoding differences between PostgreSQL and other database vendors, we cannot mix and match file uploads that also go to PostgreSQL. That is, we cannot have a file go to PostgreSQL and MySQL in the same form.

Important Note For IIS Users:
By default, IIS prevents large files from being uploaded (4MB for II6 and 28.6 for IIS 7). Failing to address this issue will result in CONTENT_LENGTH_TOO_LARGE errors. To allow larger uploads, we need to do one of three things:

1. Modify the maxAllowedContentLength property in web.config.
2. Edit request filtering in IIS Manager
3. Edit the ApplicationHost.config file.

Please see this link for a detailed description of each method.

Multi-File Upload Method Note: If using the Multi-File Upload Method and IIS, your server's PHP CGI handler mappings must have the DELETE verb set. To enable this:

  • 1. Open IIS Manager and select the site RackForms is hosted on.
  • 2. Double Click the Handler Mappings icon.
  • 3. Select the mapping for your PHP installation. The exact name will differ depending on how you installed PHP. Web Platform Installer will typically use something like: PHP_via_FastCGI. Double click this value.
  • 4. Click the Request Restrictions... button
  • 5. Click the Verbs tab and in the One of the following verbs box, enter:
    GET,HEAD,POST,DELETE,PUT

Your server should now properly handle the Multi-File uploader.


So many features, So little time

Back to Top