Hi,

Originally Posted by
billy
1) What logic would I use to load_the_proper_makes base on what_model_was_selected?
There are two ways which seem good:- Generate the "next_form" field from a computation so that it selects a different second page (as per your first post) based on the make selected.
- Use the same second page for every make and use Advanced Templates to control what gets displayed.
I think the first method would be easier from a maintenance point of view.
Also, the Advanced Templates don't yet handle expressions in IF blocks - so it makes things more messy.
Here's the basic logic for field "fmcompute1":
Code:
import function FMUserError;
import string make;
export string next_form;
next_form = make.'.html';
This simply appends ".html" to the name of the make to create the name for the next page.
You can do other things like this, depending on what naming scheme you want:
Code:
import function FMUserError;
import string make;
export string next_form;
if (make == 'ford' || make == 'gm')
{
next_form = 'usa/'.make.'.html';
}
else
{
next_form = 'intl/'.make.'.html';
}
So, this is structured for a multiform templates folder that has subfolders called "usa" and "intl" (international). Then the documents for the makes are within one of those subfolders.
2) Can this be done with out fmcompute? Is there another way?
It can be done in PHP with FormMail's Hook System - but I don't recommend writing PHP code unless you are a very experienced programmer.
The main worry is creating security vulnerabilities for your server.
The first example logic above is very simple, so you could do it with derive_fields instead:
HTML Code:
<input type="hidden" name="derive_fields" value="next_form=make.%2E%.%'html'%" />
3) How can I hide all the important stuff so no one will see/understand the logic?
You can put your fmcompute's in an INI file.
If you have PHP version 4, though, this is impractical because you can't wrap lines in an INI file.
There's an alternative in this case.
So on the second form I would insert the two values from the first page like so.
Then present another drop down for the particular model.
2008
Ford
<select name="model">
<option value="">Model</option>
<option value="explorer">Explorer</option>
<option value="mustang">Mustang</option>
<option value="taurus">Taurus</option>
</select>
Assuming you wanted all makes in the one document, using Advanced Templates, your second page (which is a FormMail template, of course) could look like this (note: this will not work in the current version):
HTML Code:
$year
$make
<if "$make" == "ford"> <!-- this type of expression is not yet supported! -->
<select name="model">
<option value="">Model</option>
<option value="explorer">Explorer</option>
<option value="mustang">Mustang</option>
<option value="taurus">Taurus</option>
</select>
</if>
As mentioned, that's the idea, but the comparison expression is not yet supported in Advanced Templates....it's coming though.
Instead, you'd have to create a flag field for every type of make (that's why I said it was messy), and the code would need to look like this:
HTML Code:
$year
$make
<if "$make_is_ford">
<select name="model">
<option value="">Model</option>
<option value="explorer">Explorer</option>
<option value="mustang">Mustang</option>
<option value="taurus">Taurus</option>
</select>
</if>
Bookmarks