[Pro] Help with Insurance Form

You have entered additional_vehicle class - it should just be additional_vehicle

and similarly class additional_driver - should just be additional_driver

These should match the code that Walter supplied

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');

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

So just to clarify - and to match Walters code

additional_drivers

and

additional_vehicles

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thanks Dave, I’ll try that


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I just looked at it again, and realized my mistake. I had you put
additional_driver (singular) as the class on each table and then
wrote .additional_drivers (plural) in my function code. I would just
change the function to singular, it’s less code to go through and
change.

Walter

On May 1, 2010, at 5:39 PM, Bob Y wrote:

Walt, Its not quite working. For the drivers list which I clicked to
select it, I put Item/Extended-New and entered for both the Name and
Value - id additional_drivers (exactly like that) and for the
vehicle list I entered - additional_vehicles ID (exactly like that).
For the drivers 2,3 and 4 tables in the Item/Extended New - Name and
Value - I entered class additional_driver (exactly like that) and
for the vehicles 2,3,and 4 tables I entered additional_vehicle class
(exactly like that). Now after applying the Protaculous Action and
entering the code that I copied and pasted exactly as you sent it in
the top Function Body section, I then published and uploaded it and
all of the drivers were still visible but the vehicles had been
hidden like I had hoped. Here’s the link http://dsmithins.com/autoinsurancequo.php
For the heck of it, I added the other code by copy and paste into
the same Function Body and when I looked at the web site all of the
drivers and vehicles were showing again. I believe that I did
everything correctly. Let me know what to try next. Thanks, Bob


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

Walt, I removed all of the s’s in the code that I could find as far as the words driver and vehicle goes and all the s’s in all of the extended fields in the form but it still looks the same.
How is it that the drivers won’t hide and yet the vehicles do hide and the vehicles appear to hide with the s’s in the code or without the s’s? You said this was going to be a bit tricky and I now know what you mean. I must be doing something wrong.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

When you added the id to the picker you also put id additional_driver into both the Name and the Value so that you have

Name: id additional_driver

Value: id additional_driver

It should be Name: id

Value: additional_driver

Similarly for the Add Vehicle picker it should be

Name: id

Value: additional_vehicle

Also when applying the class to the Additional vehicles sections you have

Name: additional_vehicle class

Value: additional_vehicle class

Where it should be

Name: class

Value: additional_vehicle

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thanks Dave, I separated the Name id and the Value additional_driver and it appears to be good but when I select additional Drivers from the menu list it doesn’t show any more drivers or vehicles.http://dsmithins.com/autoinsurancequo.php
Take a look


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

http://dsmithins.com/autoinsurancequo.php


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Yes I am at that stage too

I cannot get my additional drivers and vehicles to appear either. The problem must be with this section of Walter’s code.

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);

But I don’t know enough about it to make it work.

But as you have now learned the ID’s and Classes that appear on the page and in the code must match exactly.

Walter!

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thanks again Dave
I a novice but I am learning alot about forms


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

All right, guys. This may teach me not to type stuff without testing it first. (Probably not, but hey…)

var drivers = function(){
	var count = $F('additional_drivers');
	$$('.additional_drivers').each(function(elm,idx){
		if (idx < count){
			elm.show();
		}else{
			elm.hide();
		}
	});
};
var vehicles = function(){
	var count = $F('additional_vehicles');
	$$('.additional_vehicles').each(function(elm,idx){
		if (idx < count){
			elm.show();
		}else{
			elm.hide();
		}
	});
};
drivers();
vehicles();
$('additional_drivers').observe('change',drivers);
$('additional_vehicles').observe('change',vehicles);

With this, you can also delete the other block of code – because this will hide or show based on the value of the pickers, and it runs when the page loads.

For the technically-minded, the reason the other one didn’t work was that I thought (incorrectly) that the include() function worked the same way as the each() function, in that it would pass the index of the loop into the iterator function. It doesn’t. So each() it is.

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

All right, guys. This may teach me not to type stuff without testing it first. (Probably not, but hey…)

We are just amazed that you can come up with this all off the top of your head.

And brilliant. It works Spot On.

Now I am looking for an application for it! Thanks

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Walt, I can’t thank you enough for helping me with my Insurance Form, the form works perfectly now. It’s a good thing that there are people like yourself out there willing to help us novices. I’ve learned so much about forms with your taking me step by step that I believe I can upgrade my status from novice to Novice with a capital N. Ha!Ha! I’ll converse with you in the future next time I need some schooling. Once again THANKS, Bob Y.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options