Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamic form fill based on select

Status
Not open for further replies.

doyle9732

Programmer
Joined
Apr 12, 2002
Messages
185
Location
CA
Newbie desperately needs help!!

I'm working on a web-based purchase order form with the vendor names in a select tag. I'd like to have the text boxes for address, contact etc. automatically filled based on the user's choice of vendor (in a MSAccess database). But I don't want the user to have to 'submit' it....so I'm hoping to use onChange or something like that. I'm familiar with javascript, but I'm having trouble using both coldfusion and javascript. Any help would be greatly appreciated.
 
Hi

There is a free CustomTag on the DevEx page of Macromedia/CF resources that does exactly what you need. it needs a few params like query name, fields to use and Bingo! your related selects is good to go.

I think its called... CFThreeRelatedSelects. There is one called TwoRelatedSelects also.

Will searcha nd post link if possible!
 
Thanks! heading there now.....

....love your handle....an awesome movie, that I've watched many time..... :-)
 
hmmm.....I keep getting a TCP_ERROR for that site.... were you able to view or download the code?
 
:-)

I managed to download it....and it looks great!!

thank you! thank you! thank you!!
 
whoa! that is complicated code....a fair bit over my head.... I'm not sure if I'll be able to use it, but thanks.
 
Well!...the code is complicated..... but being a customtag, you really don't need to mess with the code. Just call the customtag at the place where you need the select box to appear. Make sure you have the customtag.cfm page in the same directory as the page you are using it in.

Write your query so that you get all the columns you want to include in the tag.

<cfquery name=&quot;qtrial&quot; datasource=&quot;#DSN#&quot;>
select vendorname, address, telephone
from vendor list
where X = X etc.
</cfquery>

The output from this query will give you:
vendorname, address, telephone

Use them in the tag:

<FORM whatever>
<CF_ThreeSelectsRelated
QUERY=&quot;qtrial&quot;
HTMLAFTER2=&quot;<BR>&quot;
NAME1=&quot;vendorname&quot;
NAME2=&quot;address&quot;
NAME3=&quot;telephone&quot;
VALUE1=&quot;vendorname&quot;
VALUE2=&quot;address&quot;
VALUE3=&quot;telephone&quot;
DISPLAY1=&quot;VENDOR&quot;
DISPLAY2=&quot;ADDRESS&quot;
DISPLAY3=&quot;CONTACT&quot;
DEFAULT1=&quot;1&quot;
SIZE1=&quot;3&quot;
SIZE2=&quot;3&quot;
SIZE3=&quot;5&quot;
WIDTH1=&quot;150&quot;
WIDTH2=&quot;150&quot;
WIDTH3=&quot;300&quot;
FORCEWIDTH1=&quot;40&quot;
FORCEWIDTH2=&quot;40&quot;
FORCEWIDTH3=&quot;90&quot;
AUTOSELECTFIRST=&quot;No&quot;
MULTIPLE3=&quot;Yes&quot;>
</FORM>

Thats it!...... as simple as it is. This was the easiest customtag that I have ever worked with and its magical. Just look at the number of downloads :-)
 
I've never used customtags, so I didn't know that I was just supposed to add them!!!

I have it working.....one select window with one 'view' area. Do you have any idea how (or if) I can have individual text boxes? There's more information than just the address - the vendor account number, terms, shipping info etc. The way I have the form laid out, the information I want to add is A) all over the form and B) I need them to be individual input boxes because the user can also add a vendor not on the list ...... I appreciate all the help!! :-)
 
ok, I clearly see the difference between 2 and 3 select (I had been using the 2) I guess I'll need to somehow manipulate the custom tag and make one for select 8!!! Should be a fun weekend! :-(

Do you know how/if I can separate them....have them each in their own cell in the table?
 
Sure will be a fun weekend!!!.... eight is quite something...if you do ge the customtag modified to accomodate for eight, do put it up for the benefit of others who might need it.

As far as the layout goes, I beleieve you can add some HTML code in the custom tag using the attribute &quot;HTMLAFTER&quot;. But am not too sure if it can work for eight!.

Looking at the requirement in post9, i am beginning to think if this tag really suits what you are trying to do. But since you seem to have figured out how to start, I will let you work on it. If you have questions, I'll try to answer them.
 
actually turned out to be nine selects.....and it didn't work.....but that webtricks site looks promising! Moving all my efforts to that! Thanks so much for all your help! I'll keep you posted on my progress! :-)
 
you give me way to much credit.....I'd imagine I'll still be working most of my weekend....

I'll keep you posted....and know that I REALLY appreciate all your time on this

:-)

have a great weekend!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top