Question about spinner and forms (send property)

21 views
Skip to first unread message

dukeofgaming

unread,
Apr 5, 2011, 11:41:41 PM4/5/11
to MooTools Users
Hi,

Quick and perhaps dumb question. Why wont the Request spinner
parameters work when set from the send property?.

http://jsfiddle.net/dukeofgaming/neQ3X/5/

I'd swear I've made it work like this, am I missing something?

Thanks in advance

Aaron Newton

unread,
Apr 6, 2011, 11:53:31 AM4/6/11
to mootool...@googlegroups.com, dukeofgaming
A couple of things.
  • you are setting options on the request, so you need to indent your options object for that per the docs
    eg. 
    form.set('send',{
        requestOptions: {
            useSpinner: true,
            spinnerTarget: form
        }
    });
  • You also need to tell it what to update (form.formUpdate(target)); You can also do form.formUpdate(target, options);
  • jsfiddle's echo/json needs you to give it some data; not really the issue here but may prevent you from seeing a result
  • finally, you've found a bug!
Check it out:


You'll note that on line 188 and 204 (and elsewhere) we store the instance on the element as "form.request" but on line 214 it's "formRequest" so it doesn't retrieve it. So element.formUpdate is broken.

For the time being, you can just create the instance the regular way (var fq = new Form.Request(form, updateElement, options)).

Would you like to open a lighthouse ticket for this bug? (just paste in this last part). I can do it, but if you do it you'll get emails as we work on it and resolve it.


Aaron

Arian Stolwijk

unread,
Apr 6, 2011, 12:05:27 PM4/6/11
to mootool...@googlegroups.com
`this.get('formRequest')` should get the Form.Request instance, which is correct, however `Element.Properties.formRequest` is broken, and also you can only do `this.get('formRequest')` because it doesn't accept multiple arguments, like is used in formUpdate.

Aaron Newton

unread,
Apr 6, 2011, 12:46:25 PM4/6/11
to mootool...@googlegroups.com
Right. Sorry, I figured that out a bit after I hit send. I figured I'd add that to lighthouse after it got created...

dukeofgaming

unread,
Apr 8, 2011, 1:52:19 PM4/8/11
to MooTools Users
Hi,

Sorry for taking so long to answer. I tried it with Form.Request and
it worked, however, on trying to parse my ajax response (in json) I
stumbled upon that my response got wrapped in an array and then into a
string, why is this?:

["{"result":"success","message":"SUCCESS","data":null}"]

Instead of this:

{"result":"success","message":"SUCCESS","data":null}

Regards,

David



On Apr 6, 11:46 am, Aaron Newton <aa...@iminta.com> wrote:
> Right. Sorry, I figured that out a bit after I hit send. I figured I'd add
> that to lighthouse after it got created...
>
>
>
>
>
>
>
> On Wed, Apr 6, 2011 at 9:05 AM, Arian Stolwijk <ar...@aryweb.nl> wrote:
> > `this.get('formRequest')` should get the Form.Request instance, which is
> > correct, however `Element.Properties.formRequest` is broken, and also you
> > can only do `this.get('formRequest')` because it doesn't accept multiple
> > arguments, like is used in formUpdate.
>
> > On Wed, Apr 6, 2011 at 5:53 PM, Aaron Newton <aa...@iminta.com> wrote:
>
> >> A couple of things.
>
> >>    - you are setting options on the request, so you need to indent your
> >>    options object for that per the docs
> >>    eg.
> >>    form.set('send',{
> >>        requestOptions: {
> >>            useSpinner: true,
> >>            spinnerTarget: form
> >>        }
> >>    });
> >>    - You also need to tell it what to update (form.formUpdate(target));
> >>    You can also do form.formUpdate(target, options);
> >>    - jsfiddle's echo/json needs you to give it some data; not really the
> >>    issue here but may prevent you from seeing a result
> >>    - finally, you've found a bug!
>
> >> Check it out:
>
> >>https://github.com/mootools/mootools-more/blob/master/Source/Forms/Fo...
>
> >> You'll note that on line 188 and 204 (and elsewhere) we store the instance
> >> on the element as "form.request" but on line 214 it's "formRequest" so it
> >> doesn't retrieve it. So element.formUpdate is broken.
>
> >> For the time being, you can just create the instance the regular way (var
> >> fq = new Form.Request(form, updateElement, options)).
>
> >> Would you like to open a lighthouse ticket for this bug? (just paste in
> >> this last part). I can do it, but if you do it you'll get emails as we work
> >> on it and resolve it.
>
> >>https://mootools.lighthouseapp.com/projects/24057-mootoolsmore
>
> >> Aaron
>

dukeofgaming

unread,
Apr 8, 2011, 1:52:41 PM4/8/11
to MooTools Users
P.S.: Has the bug already been posted?

On Apr 6, 11:46 am, Aaron Newton <aa...@iminta.com> wrote:
> Right. Sorry, I figured that out a bit after I hit send. I figured I'd add
> that to lighthouse after it got created...
>
>
>
>
>
>
>
> On Wed, Apr 6, 2011 at 9:05 AM, Arian Stolwijk <ar...@aryweb.nl> wrote:
> > `this.get('formRequest')` should get the Form.Request instance, which is
> > correct, however `Element.Properties.formRequest` is broken, and also you
> > can only do `this.get('formRequest')` because it doesn't accept multiple
> > arguments, like is used in formUpdate.
>
> > On Wed, Apr 6, 2011 at 5:53 PM, Aaron Newton <aa...@iminta.com> wrote:
>
> >> A couple of things.
>
> >>    - you are setting options on the request, so you need to indent your
> >>    options object for that per the docs
> >>    eg.
> >>    form.set('send',{
> >>        requestOptions: {
> >>            useSpinner: true,
> >>            spinnerTarget: form
> >>        }
> >>    });
> >>    - You also need to tell it what to update (form.formUpdate(target));
> >>    You can also do form.formUpdate(target, options);
> >>    - jsfiddle's echo/json needs you to give it some data; not really the
> >>    issue here but may prevent you from seeing a result
> >>    - finally, you've found a bug!
>
> >> Check it out:
>
> >>https://github.com/mootools/mootools-more/blob/master/Source/Forms/Fo...
>
> >> You'll note that on line 188 and 204 (and elsewhere) we store the instance
> >> on the element as "form.request" but on line 214 it's "formRequest" so it
> >> doesn't retrieve it. So element.formUpdate is broken.
>
> >> For the time being, you can just create the instance the regular way (var
> >> fq = new Form.Request(form, updateElement, options)).
>
> >> Would you like to open a lighthouse ticket for this bug? (just paste in
> >> this last part). I can do it, but if you do it you'll get emails as we work
> >> on it and resolve it.
>
> >>https://mootools.lighthouseapp.com/projects/24057-mootoolsmore
>
> >> Aaron
>

Aaron Newton

unread,
Apr 8, 2011, 3:44:16 PM4/8/11
to mootool...@googlegroups.com, dukeofgaming
P.S.: Has the bug already been posted?

No. If I post it, you get no notification. I can do that if you don't want to, but it means you're not in the loop.

Sorry for taking so long to answer. I tried it with Form.Request and
it worked, however, on trying to parse my ajax response (in json) I
stumbled upon that my response got wrapped in an array and then into a
string, why is this?

I'm not sure. You should create a jsfiddle that demonstrates it. 

dukeofgaming

unread,
Apr 8, 2011, 6:17:38 PM4/8/11
to MooTools Users
Reply all
Reply to author
Forward
0 new messages