Repost of:[Javascript] Adding an item to a selectlistfromanotherwindow

Robert Pollard rpollard at apple.com
Thu Sep 25 19:06:37 CDT 2003


Hey Dave,

On Thursday, September 25, 2003, at 05:58 PM, David T. Lovering wrote:

> A friendly suggestion -- using dashes is somewhat iffy when browsers  
> with various font definitions come into play.  I've had better success  
> simply writing a text entry containing the maximum number of M/W  
> characters possible into the element, and then
> changing the font-color to be the same as the background (normally  
> white).

How do you see the rest of the lines in the list if the foreground  
(text) is white?  I don't believe you can change the color of a single  
line in a select list can you?

> Also, I use the "style" definition to force the width to be a fixed  
> number of pixels (way larger than essential), so that the thing won't  
> change shape on the screen when the
> contents get tweaked.

Does this work with most all recent browsers?  Do you have a  
source/sample that I can see how to make it work?

Thanks,

Robert

>
> -- Dave Lovering  
>
> Robert Pollard wrote:
>>
>> Thanks for the research.  I have it working exactly as I want it.  I
>> have a select list which upon opening the page has a series of dashes
>> in the list as the first element.  These dashes mark the end of the
>> list and keep the list a consistent width.  When I hit the add button
>> it creates 2 new lines.  The first one is where the new selection of
>> Days will go and the last one is used to copy the dashes to it so the
>> dashes will always be the last item in the list.
>>
>> Thanks for all your time and effort,
>>
>> Robert
>>
>> On Thursday, September 25, 2003, at 04:11 PM, David Lovering wrote:
>>
>>> I do know that one generally has to scrub the entire list (storing  
>>> each
>>> value/text pair into a hashed array as you go), and then add the new
>>> items
>>> in when you rebuild the select from scratch.  I never could make the
>>> "add"
>>> method work, and it doesn't conform to W3C anyway.
>>>
>>> Anyhow, it is something to consider.
>>>
>>> -- Dave Lovering
>>>
>>> ----- Original Message -----
>>> From: "Robert Pollard" <rpollard at apple.com>
>>> To: "[JavaScript List]" <javascript at LaTech.edu>
>>> Sent: Thursday, September 25, 2003 1:00 PM
>>> Subject: Re: Repost of:[Javascript] Adding an item to a select
>>> listfromanotherwindow
>>>
>>>
>>>> I was able to make it work by adding the row before I open the other
>>>> window.  Netscape is fine and works as expected.  I even tried using
>>>> the add() method that Explorer supposedly uses and it still bombed.
>>>> So
>>>> what I do is add the row to the Select list before I open the new
>>>> window to get the selection for the new element.  It works fine.
>>>>
>>>> It would be nice to know why Explorer bombs.  I tried to connect  
>>>> from
>>>> my Windoze system and it won't even load the page correctly.  I  
>>>> would
>>>> change the JavaScript code to show an alert and it wouldn't even  
>>>> show
>>>> the alert as it did on the Mac.  Go figure!
>>>>
>>>> Thanks for your time,
>>>>
>>>> Robert Pollard
>>>>
>>>> On Thursday, September 25, 2003, at 12:23 PM, David Lovering wrote:
>>>>
>>>>> Interesting.  I'll have to think about this...
>>>>>
>>>>> -- Dave
>>>>>
>>>>> ----- Original Message -----
>>>>> From: "Robert Pollard" <rpollard at apple.com>
>>>>> To: "[JavaScript List]" <javascript at LaTech.edu>
>>>>> Sent: Thursday, September 25, 2003 9:16 AM
>>>>> Subject: Re: Repost of:[Javascript] Adding an item to a select list
>>>>> fromanotherwindow
>>>>>
>>>>>
>>>>>> Hey David,
>>>>>>
>>>>>> This is what I am doing:
>>>>>>
>>>>>> Select from list: Add a comma delimited list to the new line to  
>>>>>> this
>>>>>> list:
>>>>>>
>>>>>> A <--select this one A,B,D
>>>>>> B <--select this one
>>>>>> C
>>>>>> D <--and this one
>>>>>> E
>>>>>>
>>>>>> Select the options again and my newly added element in the list in
>>>>>> the
>>>>>> source window looks like:
>>>>>> A A,B,D
>>>>>> B <--select this one B,D
>>>>>> C
>>>>>> D <--and this one
>>>>>> E
>>>>>>
>>>>>> I'll allow the user to continue making these selections until they
>>>>>> have
>>>>>> all the patterns they need.  Each comma delimited list gets  
>>>>>> assigned
>>>>>> to
>>>>>> a new element in the source list.  This what we refer to as day
>>>>>> patterns.  Each combination of letters represents what days will  
>>>>>> be
>>>>>> used.
>>>>>>
>>>>>> Thanks for your response and help.
>>>>>>
>>>>>> I just discovered that Exploder 5.2 is blowing up but Netscape 7.0
>>>>>> seems to work fine.
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Robert
>>>>>>
>>>>>> On Thursday, September 25, 2003, at 08:55 AM, David Lovering  
>>>>>> wrote:
>>>>>>
>>>>>>> I think you are getting bitten by the comma-delimited list here.
>>>>>>> You
>>>>>>> can't
>>>>>>> stuff that into a single option.
>>>>>>>
>>>>>>> You are much better off by running a 'for loop' around the array
>>>>>>> generated
>>>>>>> by splitting the comma delimeted list, and doing each entry by
>>>>>>> itself
>>>>>>> with
>>>>>>> the new Object declaration.
>>>>>>>
>>>>>>> That should work ok -- I do it all the time.
>>>>>>>
>>>>>>> -- Dave Lovering
>>>>>>>
>>>>>>> ----- Original Message -----
>>>>>>> From: "Robert Pollard" <rpollard at apple.com>
>>>>>>> To: <javascript at LaTech.edu>
>>>>>>> Sent: Thursday, September 25, 2003 8:44 AM
>>>>>>> Subject: Repost of:[Javascript] Adding an item to a select list
>>>>>>> from
>>>>>>> anotherwindow
>>>>>>>
>>>>>>>
>>>>>>>> I'm sorry I posted this with the typo.  I had to change the code
>>>>>>>> after
>>>>>>>> I copied into the email and didn't notice I replaced the text
>>>>>>>> incorrectly.
>>>>>>>> My code doesn't have 2 options[j] in it.  I just posted it
>>>>>>>> incorrectly
>>>>>>>> to the list.
>>>>>>>>
>>>>>>>> I apologize for wasting your time with a typo.
>>>>>>>>
>>>>>>>> Here is the code as it is in my source:
>>>>>>>>
>>>>>>>> var vFields = new Option(commaDelimitedList, "",false,false);
>>>>>>>> var j =
>>>>>>>> window.opener.document.forms[0].elements[aValue[i]].length;
>>>>>>>>
>>>>>>>> It's good up until here.  This next line causes Explorer to
>>>>>>>> unexpectedly quit.
>>>>>>>> window.opener.document.forms[0].elements[aValue[i]].options[j] =
>>>>>>>> vFields;
>>>>>>>> This next line just returns a no object error.
>>>>>>>> window.opener.document.forms[0].elements[aValue[i]].options[j].v 
>>>>>>>> al
>>>>>>>> ue
>>>>>>>>  =
>>>>>>>> commaDelimitedList;
>>>>>>>>
>>>>>>>> Platform is Mac OS X 10.2.3
>>>>>>>> Explorer: 5.2
>>>>>>>>
>>>>>>>> Any ideas why this wouldn't work?  Notice the second line  
>>>>>>>> actually
>>>>>>>> returns a value.
>>>>>>>>
>>>>>>>> Thanks for any insight,
>>>>>>>>
>>>>>>>> Robert Pollard
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Javascript mailing list
>>>>>>>> Javascript at LaTech.edu
>>>>>>>> https://lists.LaTech.edu/mailman/listinfo/javascript
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Javascript mailing list
>>>>>>> Javascript at LaTech.edu
>>>>>>> https://lists.LaTech.edu/mailman/listinfo/javascript
>>>>>>
>>>>>> _______________________________________________
>>>>>> Javascript mailing list
>>>>>> Javascript at LaTech.edu
>>>>>> https://lists.LaTech.edu/mailman/listinfo/javascript
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Javascript mailing list
>>>>> Javascript at LaTech.edu
>>>>> https://lists.LaTech.edu/mailman/listinfo/javascript
>>>>
>>>> _______________________________________________
>>>> Javascript mailing list
>>>> Javascript at LaTech.edu
>>>> https://lists.LaTech.edu/mailman/listinfo/javascript
>>>>
>>>>
>>>
>>>
>>> _______________________________________________
>>> Javascript mailing list
>>> Javascript at LaTech.edu
>>> https://lists.LaTech.edu/mailman/listinfo/javascript
>>
>> _______________________________________________
>> Javascript mailing list
>> Javascript at LaTech.edu
>> https://lists.LaTech.edu/mailman/listinfo/javascript
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript




More information about the Javascript mailing list