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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drop Down Box +

Status
Not open for further replies.

LCD

MIS
Feb 19, 2001
72
US
Unfortunatly I am not a programmer, I just kinda muddle my way through this. I'm having a little trouble w/ this. What I'm trying to get is when a name is chosen in the drop down box of $ProjectFieldList$ can it just show the company name, and then automaticly fill in the number for that company in the PONumber field?

I'm providing a bit of the code I'm working with here

I realize that a resolution to this problem is ALOT to ask for. But if anyone has any ideas, or can say atleast that it can't be done.


note: $ProejectFieldList$ refers to a .txt file filled with a list of client names located on the server. (the text file can be modified if required to make this work) This program has a .dat file that has the references for all the $$ The bigest problem is that the text file with client names and numbers needs to be updated constantly by someone who has no idea how to add info into a html document. And dealing with over 3000 names+#'s coded into the html would be a pain.

<!-- Row12 //-->

<tr ID = &quot;VRow12&quot;>
<td valign=&quot;top&quot; bgcolor=&quot;#$$formBGColor&quot; align=&quot;right&quot; width=150><div ID = &quot;Row12&quot;><nobr><b>Project</b></nobr></div></td>
<td width=5> </td>
<td width=150 valign=&quot;top&quot;>
<select size=&quot;1&quot; name=&quot;Project&quot; ID=&quot;Project&quot;>
<option value=&quot;--&quot; selected></option>
$ProjectFieldList$
</select>
</td>
</tr>

<!-- Row12 End //-->

<!-- Row13 //-->

<tr ID = &quot;VRow13&quot;>
<td valign=&quot;top&quot; bgcolor=&quot;#$$formBGColor&quot; align=&quot;right&quot;><div ID = &quot;Row13&quot;><nobr><b>P.O.
Number</b></nobr></div></td>
<td> </td>
<td valign=&quot;top&quot;><input type=&quot;text&quot; name=&quot;PONumber&quot; ID=&quot;PONumber&quot; size=&quot;30&quot; value = &quot;$$PONumberDefault&quot;
maxlength=&quot;79&quot;></td>
</tr>

<!-- Row13 End //-->

Here is a sample of the text file

big shot somebody,01235284563547
client someone,12345678901234
client someone else,00123456789012
das client,23456789012361
das other client,45678901237123
the lemmings,25484756241544

I thought I might have seen somthing out there that would have made this doable if in the text file, the &quot;,&quot; was replaced with &quot; -- &quot; or somthing, but that was awhile ago, before this challange came up.

If your confused by this, welcome to my world, just sit back and laugh with me.

THANK YOU FOR YOUR HELP
 
why are you re-asking ??? and if you'd read my answer to the same question you posted a few hours ago, you'd know it needs some precisions to be answered !!!!! till it's not clear what you are looking for, you're not likely to get an answer !!!!
sooooooooooooo, again, WHAT is your problem :
displaying the text file ?
reading the text file ?
populating the text file with the numbers taken from the text file ? <-- this one has been answered very well by ??? i'm sorry i don't remeber who ?? in your &quot;other&quot; post ...
 
You said &quot;-> reading the text file ? then i don't know if this is the correct forum&quot; So I tried a diferent Forum.

The problem is that I don't understand his answer, or howto put it into my html file. Like I stated before I am not a programer/designer. I could setup a enterprise wide network before I could write a &quot;hello world&quot; program. I appologize for my ignorance in the coding world.

Here is what he (Andrew) said to use:

numbArray = new Array(24, 364, 51, ..... );

for (i=0; i <= numbArray.length; i++)
{
if ( numbArray = yourForm.yourSelect.options.selectedIndex )
yourForm.yourTextfield.value = numbArray
}

-------------------------------------
where exactly does this go?

does &quot;yourForm&quot; = the name of my HTML file?

is this right?
<input type=&quot;text&quot; name=&quot;PONumber&quot; ID=&quot;PONumber&quot; size=&quot;30&quot; value = numbArray>

should I use &quot;numbArray&quot; or change it to somthing like &quot;ponumberArray&quot; ?


Does this read the text file for both the PONumber and the ProjectField?
 

As it appears in you code that you're not using javascript but rather a server side langage to read the file (you can see it with : $ProjectFieldList$), i was suggesting you'd post in the forum for this langage, because i can't help you on this. And reading the content of the file is important for what you want to do !!!!
now for the &quot;pure&quot; javascript point, and admitting you're able to read the file (really sorry i can't help on this !!!)
-> you have to fill numbarray with the values you're getting from the file. Not 24, 364, .. but 01235284563547, 12345678901234 .... in the order you read them in the file ! that is important !
-> now, you have to tell the select box that when its value gat changed, it has something to do !!
<select size=&quot;1&quot; name=&quot;Project&quot; ID=&quot;Project&quot; onchange=&quot;javascript:fire_function()&quot;> will call the function &quot;fire_function&quot; when a value is selected in the select box
-> ok, now you just have to write the javascript function that - retrieves the number associated to the selected value and - displays it in the text box
fire_function()
{
// first of all, get the selected INDEX (will be 0 for the 1st elt, 1 for the 2nd, ... and -1 if none is selected)
// &quot;your_form&quot; is the name you gave to your form
selected_index=document.your_form.Project.SelectedIndex;
if (selected_index!=-1) // means : if an elt is selected
{
// retrieve the number, it's in the array we've built
associated_number=numbarray[selected_index];
// display it in the text box
document.your_form.PONumber.value=associated_number;
}
}
-> now you've got all the elements !!!!

 
Read what I wrote you in HTML forum.
You can ask again instead of sending the same question to other place.

Andrew | starway@mail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top