Hi, The main point of Vladimir's changes being that you cannot put a div where you had one (assuming those TRs were inside a TBODY or TABLE), it's invalid HTML. IIRC, TABLE can only contain TBODY, THEAD, or TFOOT, and TBODY can only contain TR. (Most browsers will insert a missing TBODY for you if you leave it out and put TRs directly in a TABLE.) Neither TABLE nor TBODY can contain a DIV. The validation service[1] can be helpful for this sort of thing.
Vladimir also inverted your logic, so it shows something rather than hiding it. Whether you want to do that will depend on what you want the user experience to be if JavaScript is disabled on the end user's browser. [1] http://validator.w3.org/ HTH, -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On Jun 27, 8:35 am, Vladimir Tkach <[email protected]> wrote: > Some changes: > > <script type="text/javascript" language="JavaScript"> > > document.observe("dom:loaded", > > function(){> if ($('adjType').value.length > 0){ > > $('submittingTerritory').show(); > > }} > > > ); > > </script> > > <form> > ....... > More HTML > ....... > <tr id="submittingTerritory" style="display:none" > > <td> > <b>Other Territory</b> > </td> > <td> > <?php echo $this->formSelect(' > > > > > otherTerritory', $this- > > >shortTerritory, array("onChange"=>"getTerritories()"), array > > (""=>"Select a Territory") + $this->shortTerritories) ?> > > > </td> > > </tr> > > 2009/6/26 anthony <[email protected]> > > > > > > > I am trying to figure out if I have a dynamic form, whether or not it > > is better to make use of many hide & show functions or just Ajax > > Updaters and div elements. Let me give you a example of something I > > cannot get to work: > > > <script type="text/javascript" language="JavaScript"> > > Event.observe(window,'load',function(){ > > if ($('adjType').value == ""){ > > $('submittingTerritory').hide(); > > }} > > > ); > > </script> > > > <form> > > ....... > > More HTML > > ....... > > <div id="submittingTerritory"> > > <tr> > > <td> > > <b>Other Territory</b> > > </td> > > <td> > > <?php echo $this->formSelect('otherTerritory', > > $this- > > >shortTerritory, array("onChange"=>"getTerritories()"), array > > (""=>"Select a Territory") + $this->shortTerritories) ?> > > > </td> > > </tr> > > </div> > > > When the page loads, I don't want it to show. But it shows anyway. If > > I put an alert in that function it works, so I know it s not failing > > the if statement. > > -- > Best Regards, > Vladimir Tkach > > +972-54-7574166 > [email protected] > > http://teamco-anthill.blogspot.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---
