Perfecto!
Okay, one step at a time:
Click once on your additional drivers picking list and then choose
Item / Extended from the main menu. You will see a dialog with a New
button in it. Press New, then in the sub-dialog, enter the following
Name/Value pair: id additional_drivers and okay out of the stack of
dialogs. Your picker should now have an ID attribute, which we will
use later.
Do the same thing to the additional vehicles picker, only give it the
additional_vehicles ID.
Next, click on each of your “extra” tables in turn so the table itself
is highlighted and follow these steps on each one. (You may find you
have to Command-Option-click on the table in order to select the table
itself, the default when you click on a table is to select the cell
you clicked on. You’ll know that the table is selected when its
resizing handles appear.)
When each table is selected, choose Item / Extended from the main
menu, click New, and enter the following Name/Value pair: class
additional_driver (or additional_vehicle, depending).
Now each table should have the class attribute additional_whatever.
Now apply Protaculous to the page. Click on the top Function Body
button and enter the following lump of code to hide all of your extra
tables:
$$('.additional_driver, .additional_vehicle').invoke('hide');
Preview your page at this point, and lsee if it appears the way you
expect.
If so, then proceed to the next part. Add another block of code within
the same Function Body window:
var drivers = function(){
var count = $F('additional_drivers');
$$('.additional_drivers').include(function(elm,idx){
return idx < count;
}).invoke('show');
};
var vehicles = function(){
var count = $F('additional_vehicles');
$$('.additional_vehicles').include(function(elm,idx){
return idx < count;
}).invoke('show');
};
drivers();
vehicles();
$('additional_drivers').observe('change',drivers);
$('additional_vehicles').observe('change',vehicles);
Now, when you load the page, the number of visible drivers and
vehicles should match whatever is set on the respective pickers, and
whenever you change those pickers, the same function should fire to
make them track the same. Most modern browsers do not send form
element values when the elements are hidden in this manner, so you
won’t get a bunch of empty fields in your input, only the ones that
needed to be filled in.
One thing still left to be thought about is validating these inputs.
Your form handler has no way to tell if these missing fields were
necessary or not, and won’t unless you write something custom to
handle that aspect.
One other caveat, this is all typed off the top of my head. If you get
through the first part and the second part doesn’t fly, let me know
and I’ll try to debug it. If you install the Firebug extra in Firefox,
you can see what the errors are, too.
Walter
On May 1, 2010, at 11:46 AM, Bob Y wrote:
Sorry Walt, I believe that when I copied and pasted the tables into
the HTML box, I did it wrong. But alas! I now believe that I
inserted each table correctly into the HTML box so I have uploaded
the new form. http://dsmithins.com/autoinsurancequo.php
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options