I tried your suggestion, and I got the same results.  The positioning
works when the page is loaded normally, but it doesn't work when
loaded through AJAX.

On Sep 1, 10:48 am, Berin <blorit...@d-haven.org> wrote:
> I'm trying to use a custom Rails form builder, which generates the
> code for the form elements where the element is.  For example, it is
> invoked by:
>
> <label for="incident_systems_affected">Systems Affected</label>
> <input id="incident_systems_affected" name="incident
> [systems_affected]" type="text" value="0"/>
> <script>
> new Form.Spinner('incident_systems_affected');
> </script>
>
> I can attempt hand jamming all the javascript at the end of the form
> just to see if there is a rendering difference.
>
> On Sep 1, 6:53 am, "Alex McAuley" <webmas...@thecarmarketplace.com>
> wrote:
>
> > Why not call the redrawing when the ajax is done (at the bottom of the form
> > returned by the ajax call)
>
> > Alex Mcauleyhttp://www.thevacancymarket.com
>
> > ----- Original Message -----
> > From: "Berin" <blorit...@d-haven.org>
> > To: "Prototype & script.aculo.us" <prototype-scriptaculous@googlegroups.com>
> > Sent: Monday, August 31, 2009 8:34 PM
> > Subject: [Proto-Scripty] Issue with element positioning from ajax loaded
> > page
>
> > > I've extended a form control that creates and embeds some elements in
> > > the form.  It then positions those elements based on the location and
> > > size of the text field that is being adjusted.  Everything works great
> > > when the control is created on the main web page.
>
> > > My problem is that if I load the form using AJAX, the browser is
> > > figuring out the dimensions and placement of everything while my
> > > script is being evaluated.  As a result the relative positioning is
> > > way off.  I need a way to either delay the positioning until the
> > > browser is done drawing the AJAX loaded form, or some other way of
> > > ensuring the positioning is correct.
>
> > > The error behaves the same way in Firefox 3.5, Chrome 2, and Safari
> > > 4.  The positioning is off the same amount in all of these browsers.
> > > The good news is that it is predictable, the bad news is that the
> > > positioning behaves differently whether you use AJAX or the page is
> > > loaded normally.
>
> > > My positioning code is here:
>
> > >        // Position the image buttons and make room for them in the
> > > textField
> > >        var height = this.textField.getHeight();
> > >        var width = this.textField.getWidth();
>
> > >        this.textField.setStyle({width: (width + 10) + 'px'});
>
> > >        Element.clonePosition(this.upControl.identify(),
> > > this.textField.identify(),
> > >            {setWidth: false, setHeight: false, offsetTop: 2,
> > > offsetLeft: width + 2});
> > >        Element.clonePosition(this.downControl.identify(),
> > > this.textField.identify(),
> > >            {setWidth: false, setHeight: false, offsetTop: height -
> > > 10, offsetLeft: width + 2});
--~--~---------~--~----~------------~-------~--~----~
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 prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to