Reply to Re: PHP Drop Down Selection

Your name:

Reply:


Posted by Jerry Stuckle on 05/24/07 04:06

SterLo wrote:
> On May 23, 7:48 am, SterLo <sterling.hamil...@gmail.com> wrote:
>> Sweet - how do I get it to run automatically after the page has
>> loaded?
>> I can't create an object in the header and then call it so I need to
>> call that line of javascript right after the page is done.
>> Any suggestions?
>>
>> On May 22, 12:38 pm, Philipp Grassl <p.gra...@gmx.at> wrote:
>>
>>> If you for example want to select the fourth option (here "Awaiting
>>> Customer Response") you could do it with the JavaScript-line:
>>> document.getElementsByName("tt_ticketstatusid")[0].selectedIndex=3;
>>> SterLo schrieb:
>>>> I was wondering if anyone had any good methods for this problem.
>>>> I have a drop down box that is generated:
>>>> Status: <select name="tt_ticketstatusid" class="swiftselect"><option
>>>> value="1" style="" selected="selected">Open</option>
>>>> <option value="2" style="">On Hold</option>
>>>> <option value="3" style="">Closed</option>
>>>> <option value="5" style="">Awaiting Customer Response</option>
>>>> <option value="4" style="">Potentially Resolved</option>
>>>> <option value="6" style="color: teal;">On Hold - potential future
>>>> release</option>
>>>> <option value="7" style="">Potentially Resolved, Next Release</option>
>>>> <option value="9" style="">Fixed - Next Release</option>
>>>> <option value="10" style="">Internal Change</option>
>>>> </select>
>>>> The website I am doing this with is pretty complicated and has AJAX
>>>> and PHP OOP running everywhere.
>>>> I need to have the drop down box automatically select the value 5 - I
>>>> have already located the event where I want this to take place - but I
>>>> am not sure how I would go about making a drop down box select an
>>>> option after it has been written to the page.
>>>> Maybe with Javascript?
>
>
> Well here is the actual issue.
> I used the code you gave at the bottom of the document as follows:
>
> <script type="text/javascript">
> document.getElementsByName('tt_ticketstatusid')[0].selectedIndex=1;
> </script>
>
> I figured that would work...But it didn't.
> So I created a test drop down right above it with a different name to
> see if the code was indeed correct -
> and it worked fine with a drop down box that I generated. But for some
> reasons it's not working with the one I want it to.
>
> This might have something to do with the fact that they are using AJAX
> - and here's why I think that.
> The page loads and runs the javascript - but the javascript doesn't
> see the element because the element doesn't exist because I havn't
> click the tab that will make the element exist.
>
> So now I have to figure out how to generate the javscript when the tab
> is selected...
>
>

(Top posting fixed)

Might I recommend you take this to a javascript newsgroup such as
comp.lang.javascript?

And might I also recommend you not top post?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация