[jQuery] Re: serial scroll 'not working'

2009-10-10 Thread Jan Limpens

Forgot to say: only the third set has pictures in it right now

2009/10/10 Jan Limpens :
> Sorry for the dumb title, but f I knew what it was, I'd probably not
> write this message
>
> At http://limpens.com I want to show my portfolios from flick
> photosets. I would want to use serialscroll to navigate within large
> sets.
> I think, I did it all as in the plugin's demo site, but out of some
> reason, it won't scroll. All the code is in
> http://limpens.com/js/main.js . If someone could tell me, what I am
> doing wrong, I'd be much obliged :)
>
> --
> Jan
>



-- 
Jan


[jQuery] serial scroll 'not working'

2009-10-10 Thread Jan Limpens

Sorry for the dumb title, but f I knew what it was, I'd probably not
write this message

At http://limpens.com I want to show my portfolios from flick
photosets. I would want to use serialscroll to navigate within large
sets.
I think, I did it all as in the plugin's demo site, but out of some
reason, it won't scroll. All the code is in
http://limpens.com/js/main.js . If someone could tell me, what I am
doing wrong, I'd be much obliged :)

-- 
Jan


[jQuery] Re: trying to talk to googleadservices via $.getScript()

2009-08-31 Thread Jan Limpens
yip, that was it!

2009/8/31 Jan Limpens 

> aha! adbock?? maybe...
>
>
> 2009/8/31 Jan Limpens 
>
>> firebug gives me this in html view:
>> http://www.googleadservices.com/pagead/conversion.js?_=1251741522425"</a>;> Failed
>> to load source for:
>> <a  rel="nofollow" href="http://www.googleadservices.com/pagead/conversion.js?_=1251741522425">http://www.googleadservices.com/pagead/conversion.js?_=1251741522425</a>
>> 
>>
>> the qs is not mine, if jq adds is to prevent caching it is actually doing
>> a bad service to me.
>> the given address works just fine.
>>
>>
>>
>> 2009/8/31 Jan Limpens 
>>
>>> in chrome and ie that is. firefox still eats it.
>>>
>>>
>>> 2009/8/31 Jan Limpens 
>>>
>>>> magic! the second, I wrote this post, it started to work.
>>>>
>>>> 2009/8/31 Jan Limpens 
>>>>
>>>> Hello,
>>>>>
>>>>> miraculously enough, this call
>>>>>
>>>>> $.getScript('http://www.googleadservices.com/pagead/conversion.js',
>>>>> function() { confirm('g'); });
>>>>>
>>>>> does nothing and this one
>>>>>
>>>>> $.getScript('http://tracker.webtraffic.com.br/statistic.js',
>>>>> function() {confirm('w')});
>>>>>
>>>>> gives me the dialog. On firefox and IE (didn't test the others).
>>>>>
>>>>> This is completely weird, but it does not surprise me from a company,
>>>>> that gives this kind of noop code to us:
>>>>>
>>>>> if (1) {
>>>>>   var google_conversion_value = 1;
>>>>> }
>>>>>
>>>>> I mean, seriously (taken from
>>>>> http://www.google.com/adwords/learningcenter/text/19216.html)!
>>>>>
>>>>> But - anyone did come around this somehow, or maybe test this in
>>>>> his/her firebug console?
>>>>>
>>>>> --
>>>>> Jan
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Jan
>>>>
>>>
>>>
>>>
>>> --
>>> Jan
>>>
>>
>>
>>
>> --
>> Jan
>>
>
>
>
> --
> Jan
>



-- 
Jan


[jQuery] Re: trying to talk to googleadservices via $.getScript()

2009-08-31 Thread Jan Limpens
aha! adbock?? maybe...

2009/8/31 Jan Limpens 

> firebug gives me this in html view:
> http://www.googleadservices.com/pagead/conversion.js?_=1251741522425"</a>;> Failed
> to load source for:
> <a  rel="nofollow" href="http://www.googleadservices.com/pagead/conversion.js?_=1251741522425">http://www.googleadservices.com/pagead/conversion.js?_=1251741522425</a>
> 
>
> the qs is not mine, if jq adds is to prevent caching it is actually doing a
> bad service to me.
> the given address works just fine.
>
>
>
> 2009/8/31 Jan Limpens 
>
>> in chrome and ie that is. firefox still eats it.
>>
>>
>> 2009/8/31 Jan Limpens 
>>
>>> magic! the second, I wrote this post, it started to work.
>>>
>>> 2009/8/31 Jan Limpens 
>>>
>>> Hello,
>>>>
>>>> miraculously enough, this call
>>>>
>>>> $.getScript('http://www.googleadservices.com/pagead/conversion.js',
>>>> function() { confirm('g'); });
>>>>
>>>> does nothing and this one
>>>>
>>>> $.getScript('http://tracker.webtraffic.com.br/statistic.js', function()
>>>> {confirm('w')});
>>>>
>>>> gives me the dialog. On firefox and IE (didn't test the others).
>>>>
>>>> This is completely weird, but it does not surprise me from a company,
>>>> that gives this kind of noop code to us:
>>>>
>>>> if (1) {
>>>>   var google_conversion_value = 1;
>>>> }
>>>>
>>>> I mean, seriously (taken from
>>>> http://www.google.com/adwords/learningcenter/text/19216.html)!
>>>>
>>>> But - anyone did come around this somehow, or maybe test this in his/her
>>>> firebug console?
>>>>
>>>> --
>>>> Jan
>>>>
>>>
>>>
>>>
>>> --
>>> Jan
>>>
>>
>>
>>
>> --
>> Jan
>>
>
>
>
> --
> Jan
>



-- 
Jan


[jQuery] Re: trying to talk to googleadservices via $.getScript()

2009-08-31 Thread Jan Limpens
firebug gives me this in html view:
http://www.googleadservices.com/pagead/conversion.js?_=1251741522425"</a>;>Failed
to load source for:
<a  rel="nofollow" href="http://www.googleadservices.com/pagead/conversion.js?_=1251741522425">http://www.googleadservices.com/pagead/conversion.js?_=1251741522425</a>


the qs is not mine, if jq adds is to prevent caching it is actually doing a
bad service to me.
the given address works just fine.


2009/8/31 Jan Limpens 

> in chrome and ie that is. firefox still eats it.
>
>
> 2009/8/31 Jan Limpens 
>
>> magic! the second, I wrote this post, it started to work.
>>
>> 2009/8/31 Jan Limpens 
>>
>> Hello,
>>>
>>> miraculously enough, this call
>>>
>>> $.getScript('http://www.googleadservices.com/pagead/conversion.js',
>>> function() { confirm('g'); });
>>>
>>> does nothing and this one
>>>
>>> $.getScript('http://tracker.webtraffic.com.br/statistic.js', function()
>>> {confirm('w')});
>>>
>>> gives me the dialog. On firefox and IE (didn't test the others).
>>>
>>> This is completely weird, but it does not surprise me from a company,
>>> that gives this kind of noop code to us:
>>>
>>> if (1) {
>>>   var google_conversion_value = 1;
>>> }
>>>
>>> I mean, seriously (taken from
>>> http://www.google.com/adwords/learningcenter/text/19216.html)!
>>>
>>> But - anyone did come around this somehow, or maybe test this in his/her
>>> firebug console?
>>>
>>> --
>>> Jan
>>>
>>
>>
>>
>> --
>> Jan
>>
>
>
>
> --
> Jan
>



-- 
Jan


[jQuery] Re: trying to talk to googleadservices via $.getScript()

2009-08-31 Thread Jan Limpens
in chrome and ie that is. firefox still eats it.

2009/8/31 Jan Limpens 

> magic! the second, I wrote this post, it started to work.
>
> 2009/8/31 Jan Limpens 
>
> Hello,
>>
>> miraculously enough, this call
>>
>> $.getScript('http://www.googleadservices.com/pagead/conversion.js',
>> function() { confirm('g'); });
>>
>> does nothing and this one
>>
>> $.getScript('http://tracker.webtraffic.com.br/statistic.js', function()
>> {confirm('w')});
>>
>> gives me the dialog. On firefox and IE (didn't test the others).
>>
>> This is completely weird, but it does not surprise me from a company, that
>> gives this kind of noop code to us:
>>
>> if (1) {
>>   var google_conversion_value = 1;
>> }
>>
>> I mean, seriously (taken from
>> http://www.google.com/adwords/learningcenter/text/19216.html)!
>>
>> But - anyone did come around this somehow, or maybe test this in his/her
>> firebug console?
>>
>> --
>> Jan
>>
>
>
>
> --
> Jan
>



-- 
Jan


[jQuery] Re: trying to talk to googleadservices via $.getScript()

2009-08-31 Thread Jan Limpens
magic! the second, I wrote this post, it started to work.

2009/8/31 Jan Limpens 

> Hello,
>
> miraculously enough, this call
>
> $.getScript('http://www.googleadservices.com/pagead/conversion.js',
> function() { confirm('g'); });
>
> does nothing and this one
>
> $.getScript('http://tracker.webtraffic.com.br/statistic.js', function()
> {confirm('w')});
>
> gives me the dialog. On firefox and IE (didn't test the others).
>
> This is completely weird, but it does not surprise me from a company, that
> gives this kind of noop code to us:
>
> if (1) {
>   var google_conversion_value = 1;
> }
>
> I mean, seriously (taken from
> http://www.google.com/adwords/learningcenter/text/19216.html)!
>
> But - anyone did come around this somehow, or maybe test this in his/her
> firebug console?
>
> --
> Jan
>



-- 
Jan


[jQuery] trying to talk to googleadservices via $.getScript()

2009-08-31 Thread Jan Limpens
Hello,

miraculously enough, this call

$.getScript('http://www.googleadservices.com/pagead/conversion.js',
function() { confirm('g'); });

does nothing and this one

$.getScript('http://tracker.webtraffic.com.br/statistic.js', function()
{confirm('w')});

gives me the dialog. On firefox and IE (didn't test the others).

This is completely weird, but it does not surprise me from a company, that
gives this kind of noop code to us:

if (1) {
  var google_conversion_value = 1;
}

I mean, seriously (taken from
http://www.google.com/adwords/learningcenter/text/19216.html)!

But - anyone did come around this somehow, or maybe test this in his/her
firebug console?

-- 
Jan


[jQuery] validate classbased via ajax request

2009-08-25 Thread Jan Limpens
Hello,

my forms are all css class based validated. Now I need to check some on them
serverside, so I overload the regular validation methods (or is there a
better way?).

jQuery.validator.addMethod("date", function(value, element) {
var preValid = this.optional(element) ||
/^\d\d?\/\d\d?\/\d\d\d?\d?$/.test(value);
if (!preValid)
return false;
$.getJSON(urlDefs.validateDate + "?date=" + value, function(data) {
var result = data.Data;
// what can I do with this result?
// how can I set element valid?
});
}, jQuery.validator.messages['date']);

I might be doing something wrong...
I know there is a remote({}) method, but how could I use it from there? It
might work less asynchronously, thus easier...
-- 
Jan


[jQuery] Re: why is this href firing???

2009-07-09 Thread Jan Limpens
I was not aware of that - I wonder if there are other types of buttons,
then :)

2009/7/9 Nick Fitzsimons 

>
> 2009/7/9 Jan Limpens :
> > in fact, it was a button at first, but it always submitted :)
> > I ought to switch that back :)
> >
>
> As long as you specify the type, it should be fine. If you don't, the
> default type is "submit", so you must explicitly use:
> button content
>
> IE gets this wrong and has a default type of "button", just to confuse
> matters ;-)
>
> HTH,
>
> Nick.
> --
> Nick Fitzsimons
> http://www.nickfitz.co.uk/
>



-- 
Jan


[jQuery] Re: why is this href firing???

2009-07-09 Thread Jan Limpens
in fact, it was a button at first, but it always submitted :)
I ought to switch that back :)

2009/7/9 NickFitz 

>
> On Jul 9, 5:20 am, Karl Swedberg  wrote:
> > On Jul 8, 2009, at 11:47 AM, MorningZ wrote:
> >
> > > I see this (stopping links in their tracks) a lot and it's puzzling,
> > > so i think:
> >
> > > *if you do not want an  to actually follow a link, then don't use
> > > an , use a  or something instead and use CSS to make it look
> > > like a link to the user*
> >
> > > That will 100% solve all issues with a hyperlink acting like, well, a
> > > hyperlink  :-)
> >
> > The problem with using a  in those cases is that it isn't
> > accessible. Links can be focused. You can tab to them and press Enter/
> > Return, and the click event will fire. Not so with spans.
> >
>
> The HTML 4.01  element with type="button" (or  type="button"> if you don't need anything more than basic text
> content) is specifically intended for just this kind of thing:
> 
> 
>
> Focusable, accessible, and doesn't have any default behaviour which
> has to be overridden. If you don't like the fact that it looks like a
> button, just style it with CSS: all browsers that JQuery supports
> allow this. (But remember to set "overflow: visible;" in the styling,
> or IE6 (as usual) can make a mess of it if it under certain
> circumstances:  >.)
>
> Regards,
>
> Nick.
> --
> Nick Fitzsimons
> http://www.nickfitz.co.uk/
>
>


-- 
Jan


[jQuery] Re: why is this href firing???

2009-07-08 Thread Jan Limpens
I found out, that the plugin worked, when there is only one, but not if
there are many on a page.

so it was not enumerating a multiple result :)

the plugin now works:
(function($) {
jQuery.fn.spinner = function() {
return this.each(function() { // here we go!
var input = $(this);
var makeButton = function(cssClass, text) {
return jQuery('' + text
+ '');
};
var spin = function(value) {
var val = parseInt(input.val());
var newValue = isNaN(val)
? 0
: val;
if (newValue + value > -1) {
newValue += value;
}
input.val(newValue);
};
input.wrap('');
var spinDown = makeButton('spinDown', '-');
input.before(spinDown);
spinDown.click(function() {
return spin(-1);
});
var spinUp = makeButton('spinUp', '+');
input.after(spinUp);
spinUp.click(function() {
return spin(1);
});
});
};
})(jQuery);



2009/7/8 Jan Limpens 

> But that is not the problem. It is 100% ok to put a click event on an
> anchor and expect it not to pass on the request, if you return false.
>
> For the sake of the argument, I changed the anchor to a div and I still get
> no exception and it still does nothing.
>
> If I do this:
>
> spinDown.click(function() {
> alert('down');
> return false;
> //return spin(-1);
> });
>
> a click renders no alert.
> so as the plugin does all the rest it is asked, it seems it does not attach
> the click event in a way I would want it to.
>
> any ideas?
>
> 2009/7/8 MorningZ 
>
>
>> I see this (stopping links in their tracks) a lot and it's puzzling,
>> so i think:
>>
>> *if you do not want an  to actually follow a link, then don't use
>> an , use a  or something instead and use CSS to make it look
>> like a link to the user*
>>
>> That will 100% solve all issues with a hyperlink acting like, well, a
>> hyperlink  :-)
>>
>> Problem with:
>> return false;
>> or
>> e.preventDefault()
>>
>> is that if a JavaScript error happened before that, then either of
>> those lines will never execute to prevent the browser from going
>> wherever
>>
>>
>> On Jul 8, 11:09 am, BaBna  wrote:
>> > I don't really see where your link is, but if you had .click(function
>> > (e){e.preventDefault();} to your link, that should disable it.
>> >
>> > On Jul 8, 3:54 pm, Jan Limpens  wrote:
>> >
>> > > hi there!
>> >
>> > > this plugin extends an input text with 2 links that increase or
>> decrease
>> > > it's value by 1.
>> > > unfortunately, due to my dumbness it is not working as I would expect.
>> >
>> > > When one clicks at one of the links, the link works normally as a link
>> would
>> > > (making the request to "").
>> >
>> > > Anybody could tell me what I am doing wrong - I am definitely
>> suffering from
>> > > jquery blindness here...
>> >
>> > > (function($) {
>> > > jQuery.fn.spinner = function() {
>> > > var input = $(this);
>> > > var makeButton = function(cssClass, text) {
>> > > return $('' +
>> text +
>> > > '');
>> > > };
>> > > var spin = function(value) {
>> > > var val = parseInt(input.val());
>> > > var newValue = isNaN(val)
>> > > ? 0
>> > > : val;
>> > > if (newValue + value > -1) {
>> > > newValue += value;
>> > > }
>> > > input.val(newValue);
>> > > return false;
>> > > };
>> > > input.wrap('');
>> > > var spinDown = makeButton('spinDown', '-');
>> > > input.before(spinDown);
>> > > spinDown.click(function() {
>> > > return spin(-1);
>> > > });
>> > > var spinUp = makeButton('spinUp', '+');
>> > > input.after(spinUp);
>> > > spinUp.click(function() {
>> > > return spin(1);
>> > > });
>> > > };
>> >
>> > > })(jQuery);
>> >
>> > > 
>> >
>> > > $('#spinMe').spinner();
>> >
>> > > --
>> > > Jan
>>
>
>
>
> --
> Jan
>



-- 
Jan


[jQuery] Re: why is this href firing???

2009-07-08 Thread Jan Limpens
But that is not the problem. It is 100% ok to put a click event on an anchor
and expect it not to pass on the request, if you return false.

For the sake of the argument, I changed the anchor to a div and I still get
no exception and it still does nothing.

If I do this:

spinDown.click(function() {
alert('down');
return false;
//return spin(-1);
});

a click renders no alert.
so as the plugin does all the rest it is asked, it seems it does not attach
the click event in a way I would want it to.

any ideas?

2009/7/8 MorningZ 

>
> I see this (stopping links in their tracks) a lot and it's puzzling,
> so i think:
>
> *if you do not want an  to actually follow a link, then don't use
> an , use a  or something instead and use CSS to make it look
> like a link to the user*
>
> That will 100% solve all issues with a hyperlink acting like, well, a
> hyperlink  :-)
>
> Problem with:
> return false;
> or
> e.preventDefault()
>
> is that if a JavaScript error happened before that, then either of
> those lines will never execute to prevent the browser from going
> wherever
>
>
> On Jul 8, 11:09 am, BaBna  wrote:
> > I don't really see where your link is, but if you had .click(function
> > (e){e.preventDefault();} to your link, that should disable it.
> >
> > On Jul 8, 3:54 pm, Jan Limpens  wrote:
> >
> > > hi there!
> >
> > > this plugin extends an input text with 2 links that increase or
> decrease
> > > it's value by 1.
> > > unfortunately, due to my dumbness it is not working as I would expect.
> >
> > > When one clicks at one of the links, the link works normally as a link
> would
> > > (making the request to "").
> >
> > > Anybody could tell me what I am doing wrong - I am definitely suffering
> from
> > > jquery blindness here...
> >
> > > (function($) {
> > > jQuery.fn.spinner = function() {
> > > var input = $(this);
> > > var makeButton = function(cssClass, text) {
> > > return $('' +
> text +
> > > '');
> > > };
> > > var spin = function(value) {
> > > var val = parseInt(input.val());
> > > var newValue = isNaN(val)
> > > ? 0
> > > : val;
> > > if (newValue + value > -1) {
> > > newValue += value;
> > > }
> > > input.val(newValue);
> > > return false;
> > > };
> > > input.wrap('');
> > > var spinDown = makeButton('spinDown', '-');
> > > input.before(spinDown);
> > > spinDown.click(function() {
> > > return spin(-1);
> > > });
> > > var spinUp = makeButton('spinUp', '+');
> > > input.after(spinUp);
> > > spinUp.click(function() {
> > > return spin(1);
> > > });
> > > };
> >
> > > })(jQuery);
> >
> > > 
> >
> > > $('#spinMe').spinner();
> >
> > > --
> > > Jan
>



-- 
Jan


[jQuery] why is this href firing???

2009-07-08 Thread Jan Limpens
hi there!

this plugin extends an input text with 2 links that increase or decrease
it's value by 1.
unfortunately, due to my dumbness it is not working as I would expect.

When one clicks at one of the links, the link works normally as a link would
(making the request to "").

Anybody could tell me what I am doing wrong - I am definitely suffering from
jquery blindness here...


(function($) {
jQuery.fn.spinner = function() {
var input = $(this);
var makeButton = function(cssClass, text) {
return $('' + text +
'');
};
var spin = function(value) {
var val = parseInt(input.val());
var newValue = isNaN(val)
? 0
: val;
if (newValue + value > -1) {
newValue += value;
}
input.val(newValue);
return false;
};
input.wrap('');
var spinDown = makeButton('spinDown', '-');
input.before(spinDown);
spinDown.click(function() {
return spin(-1);
});
var spinUp = makeButton('spinUp', '+');
input.after(spinUp);
spinUp.click(function() {
return spin(1);
});
};
})(jQuery);



$('#spinMe').spinner();

-- 
Jan


[jQuery] Re: jq.ui and the embedded autocomplete plugin

2009-02-10 Thread Jan Limpens

Ah, never mind, found it:
http://jquery-ui.googlecode.com/svn/branches/dev/autocomplete/ui/

On Feb 10, 4:55 pm, Jan  Limpens  wrote:
> Thanks a lot!
> Any idea, where autocomplete sans ui has its page or repository?
>
> Anything further, I'll move to the other list...
>
> On Feb 10, 4:45 pm, "Richard D. Worth"  wrote:
>
> > After the jQuery UI 1.6rc2 release, the Autocomplete plugin was removed
> > pending some further refactoring and changes for inclusion in a future
> > version of jQuery UI. It is still being developed, but will not be in the
> > final 1.6 version (and has not been in any of the later release candidates:
> > rc3-rc6).
>
> > The same happened at the same time with 3 other plugins that were in the
> > 1.6rc2: colorpicker, magnifier, and spinner. The planning and development
> > for these (where we welcome feedback) continues here:
>
> >http://wiki.jqueryui.com/ColorPickerhttp://wiki.jqueryui.com/SelectCo...
>
> > Note: If you have any further questions about jQuery UI, I invite you to
> > join the jQuery UI mailing list:
>
> >http://groups.google.com/group/jquery-ui
>
> > Thanks.
>
> > - Richard
>
> > On Tue, Feb 10, 2009 at 1:22 PM, Jan Limpens  wrote:
>
> > > Earlier I received an embedded autocomplete plugin, when I downloaded
> > > a jquery.ui compilation.
> > > Now this plugin is missing and it seems like the rc2 version, I still
> > > have got here, does not catch on (no errors, just does not react in
> > > any way) anymore.
> > > Is this still maintained? Where can I get it or should I better look
> > > elsewhere?
>
> > > --Jan
>
>


[jQuery] Re: jq.ui and the embedded autocomplete plugin

2009-02-10 Thread Jan Limpens

Thanks a lot!
Any idea, where autocomplete sans ui has its page or repository?

Anything further, I'll move to the other list...

On Feb 10, 4:45 pm, "Richard D. Worth"  wrote:
> After the jQuery UI 1.6rc2 release, the Autocomplete plugin was removed
> pending some further refactoring and changes for inclusion in a future
> version of jQuery UI. It is still being developed, but will not be in the
> final 1.6 version (and has not been in any of the later release candidates:
> rc3-rc6).
>
> The same happened at the same time with 3 other plugins that were in the
> 1.6rc2: colorpicker, magnifier, and spinner. The planning and development
> for these (where we welcome feedback) continues here:
>
> http://wiki.jqueryui.com/ColorPickerhttp://wiki.jqueryui.com/SelectComboboxAutocompletehttp://wiki.jqueryui.com/Spinner
>
> Note: If you have any further questions about jQuery UI, I invite you to
> join the jQuery UI mailing list:
>
> http://groups.google.com/group/jquery-ui
>
> Thanks.
>
> - Richard
>
> On Tue, Feb 10, 2009 at 1:22 PM, Jan Limpens  wrote:
>
> > Earlier I received an embedded autocomplete plugin, when I downloaded
> > a jquery.ui compilation.
> > Now this plugin is missing and it seems like the rc2 version, I still
> > have got here, does not catch on (no errors, just does not react in
> > any way) anymore.
> > Is this still maintained? Where can I get it or should I better look
> > elsewhere?
>
> > --Jan
>
>


[jQuery] jq.ui and the embedded autocomplete plugin

2009-02-10 Thread Jan Limpens

Earlier I received an embedded autocomplete plugin, when I downloaded
a jquery.ui compilation.
Now this plugin is missing and it seems like the rc2 version, I still
have got here, does not catch on (no errors, just does not react in
any way) anymore.
Is this still maintained? Where can I get it or should I better look
elsewhere?

--Jan


[jQuery] Re: "subclassing" ajaxForm

2009-02-09 Thread Jan Limpens

ok, seems like i got it on my own, with a bunch of help from malsup's
blog and the jq docs.

looks like that. that's ok, you think?

(function($) {
jQuery.fn.jsonForm = function(options) {
var opts = $.extend({}, $.fn.jsonForm.defaults, options);
return this.each(function(){
jQuery(this).ajaxForm({
type: "json",
success: function(data){
// private implementation here ...
opts.success(data);
}
});
});
};
$.fn.jsonForm.defaults = {
success: function(){}
 };
})(jQuery);

On Feb 9, 5:20 pm, Jan  Limpens  wrote:
> When I try to do this, firebug does not alert me of anything wrong,
> the form is posted normally (no ajax).
> What mistake am I making?
>
> // requires jquery.forms plugin
> jQuery.fn.jsonForm = function(onSuccess) {
>     this.ajaxForm({
>     dataType: 'json',
>     success: function(data) {
>         if (data.Message) {
>             alert(data.Message); // my json reply always has these 2
> fields
>         }
>         if (data.ActionUrl != null) {
>             top.location = data.ActionUrl;
>         }
>         if (onSuccess != null) {
>             onSuccess(data); // what if onSuccess has an empty
> signature?
>         }
>     }
>
> });
> }
>
> So I can call it like so:
>
>         var onSuccess = function(data){
>                 $.each(data.Customer, function(i, item){
>                         $('#searchResultCustomers').append(""+ item.Name 
> +"");
>                 });
>         });
>         $('.jsonFormCustomer').jsonForm(onSuccess);
>
> How could I call jsonForm without a null param, too?
>
> Help greatly appreciated!


[jQuery] "subclassing" ajaxForm

2009-02-09 Thread Jan Limpens

When I try to do this, firebug does not alert me of anything wrong,
the form is posted normally (no ajax).
What mistake am I making?

// requires jquery.forms plugin
jQuery.fn.jsonForm = function(onSuccess) {
this.ajaxForm({
dataType: 'json',
success: function(data) {
if (data.Message) {
alert(data.Message); // my json reply always has these 2
fields
}
if (data.ActionUrl != null) {
top.location = data.ActionUrl;
}
if (onSuccess != null) {
onSuccess(data); // what if onSuccess has an empty
signature?
}
}
});
}

So I can call it like so:

var onSuccess = function(data){
$.each(data.Customer, function(i, item){
$('#searchResultCustomers').append(""+ item.Name 
+"");
});
});
$('.jsonFormCustomer').jsonForm(onSuccess);

How could I call jsonForm without a null param, too?

Help greatly appreciated!


[jQuery] Re: event fires exponentially

2008-12-16 Thread Jan Limpens

Yes I do. It's just a bunch of check boxes to filter and order a
result. It is not updating the form, too. Nothing disastrous about
this.

Keep cool,
Jan

On Tue, Dec 16, 2008 at 5:42 PM, MorningZ  wrote:
>
> This original code you posted
>
>
> $(document).ready(function(){
>$form = $('#filter-form');
>$form.ajaxForm({
>//dataType: 'json',
>success: function(){
>alert("peng");
>},
>target: "#layout-child-output"
>});
>$('input', $form).change(function(){
>$form.submit();
>});
> })
>
>
>
>
> has *disaster* written all over it..so every single time a
> form item changes you want to submit the whole entire form?   that's
> just inefficient design asking for all kinds of problems like race
> conditions and the like



-- 
Jan


[jQuery] Re: event fires exponentially

2008-12-16 Thread Jan Limpens

And this does work:

$(document).ready(function(){
$form = $('#filter-form');
$('input', $form).change(function(){
$form.ajaxSubmit({
dataType: 'json',
success: function(){},
target: "#layout-child-output"
});
});
})

strange, though

On Tue, Dec 16, 2008 at 3:27 PM, Jan Limpens  wrote:
> Must be some bug in ajaxForm, I guess.
>
> if I change
>   $('input', $form).change(function(){
>   $form.submit();
>   });
>
> to
>   $('input', $form).change(function(){
>   alert('peng');
>   });
>
> it fires once only, otherwise I get the exponential behavior. My guess
> is, that ajaxForm.submit() somehow touches the inputs and triggers the
> change event recursively. But that is just my impression...
>
> On Tue, Dec 16, 2008 at 3:12 PM, Jan Limpens  wrote:
>> No, unfortunately... but I may be able to put something up...
>>
>> On Tue, Dec 16, 2008 at 3:05 PM, Eric Hobo Garside  wrote:
>>>
>>> Do you have a live environment where this is hosted, or at least the
>>> code for the page to test it locally? Looks like it should be working
>>> fine, at face value.
>>>
>>> On Dec 16, 11:55 am, "Jan Limpens"  wrote:
>>>> Hi guys,
>>>>
>>>> I have this piece of innocent looking code:
>>>>
>>>> 
>>>> $(document).ready(function(){
>>>> $form = $('#filter-form');
>>>> $form.ajaxForm({
>>>> //dataType: 'json',
>>>> success: function(){
>>>> alert("peng");
>>>> },
>>>> target: "#layout-child-output"
>>>> });
>>>> $('input', $form).change(function(){
>>>> $form.submit();
>>>> });})
>>>>
>>>> 
>>>>
>>>> If I check one checkbox, I get one submit, for 2 2, however for 3 4,
>>>> for 4 16, and so on until the server crashes.
>>>>
>>>> Any idea what is wrong here?
>>>> --
>>>> Jan
>>
>>
>>
>> --
>> Jan
>>
>
>
>
> --
> Jan
>



-- 
Jan


[jQuery] Re: event fires exponentially

2008-12-16 Thread Jan Limpens

Must be some bug in ajaxForm, I guess.

if I change
   $('input', $form).change(function(){
   $form.submit();
   });

to
   $('input', $form).change(function(){
   alert('peng');
   });

it fires once only, otherwise I get the exponential behavior. My guess
is, that ajaxForm.submit() somehow touches the inputs and triggers the
change event recursively. But that is just my impression...

On Tue, Dec 16, 2008 at 3:12 PM, Jan Limpens  wrote:
> No, unfortunately... but I may be able to put something up...
>
> On Tue, Dec 16, 2008 at 3:05 PM, Eric Hobo Garside  wrote:
>>
>> Do you have a live environment where this is hosted, or at least the
>> code for the page to test it locally? Looks like it should be working
>> fine, at face value.
>>
>> On Dec 16, 11:55 am, "Jan Limpens"  wrote:
>>> Hi guys,
>>>
>>> I have this piece of innocent looking code:
>>>
>>> 
>>> $(document).ready(function(){
>>> $form = $('#filter-form');
>>> $form.ajaxForm({
>>> //dataType: 'json',
>>> success: function(){
>>> alert("peng");
>>> },
>>> target: "#layout-child-output"
>>> });
>>> $('input', $form).change(function(){
>>> $form.submit();
>>> });})
>>>
>>> 
>>>
>>> If I check one checkbox, I get one submit, for 2 2, however for 3 4,
>>> for 4 16, and so on until the server crashes.
>>>
>>> Any idea what is wrong here?
>>> --
>>> Jan
>
>
>
> --
> Jan
>



-- 
Jan


[jQuery] Re: event fires exponentially

2008-12-16 Thread Jan Limpens

No, unfortunately... but I may be able to put something up...

On Tue, Dec 16, 2008 at 3:05 PM, Eric Hobo Garside  wrote:
>
> Do you have a live environment where this is hosted, or at least the
> code for the page to test it locally? Looks like it should be working
> fine, at face value.
>
> On Dec 16, 11:55 am, "Jan Limpens"  wrote:
>> Hi guys,
>>
>> I have this piece of innocent looking code:
>>
>> 
>> $(document).ready(function(){
>> $form = $('#filter-form');
>> $form.ajaxForm({
>> //dataType: 'json',
>> success: function(){
>> alert("peng");
>> },
>> target: "#layout-child-output"
>> });
>> $('input', $form).change(function(){
>> $form.submit();
>> });})
>>
>> 
>>
>> If I check one checkbox, I get one submit, for 2 2, however for 3 4,
>> for 4 16, and so on until the server crashes.
>>
>> Any idea what is wrong here?
>> --
>> Jan



-- 
Jan


[jQuery] event fires exponentially

2008-12-16 Thread Jan Limpens

Hi guys,

I have this piece of innocent looking code:


$(document).ready(function(){
$form = $('#filter-form');
$form.ajaxForm({
//dataType: 'json',
success: function(){
alert("peng");
},
target: "#layout-child-output"
});
$('input', $form).change(function(){
$form.submit();
});
})


If I check one checkbox, I get one submit, for 2 2, however for 3 4,
for 4 16, and so on until the server crashes.

Any idea what is wrong here?
-- 
Jan


[jQuery] layout of a project / good practices

2008-12-15 Thread Jan Limpens

Hi guys,

I wonder if anybody knows a good page/tutorial/etc... that explains
good practices in structuring a project that uses jquery.
Currently I have a mess of files that all populate the global name
space with things currently in need.
If my server side programming looked like that, I'd through me out of
the window :)

I need to fix this up, probably putting things in classes (well, these
funny top level functions that work like classes, in a way) etc..

But how does this work with things like $(document).load(...)? And
many questions (most of which have not come into my mind) more.

Any pointers?

-- 
Jan


[jQuery] Re: passing args to a delegate

2008-12-15 Thread Jan Limpens

javascript just keeps amazing me more and more :)
thanks for the insight!

On Sat, Dec 13, 2008 at 8:49 PM, Jeffrey Kretz  wrote:
>
> Mike's suggestion involves creating a javascript "closure".
>
> There are a number of good articles on closues.
>
> http://www.google.com/search?hl=en&q=javascript+closures&rlz=1W1GGLL_en
>
> But essentially, when you create a function that has a reference to a value 
> outside of its scope, that function is created as a closure, with its own 
> context that has access to those variables, even when they've been changed on 
> the global scope.
>
> Try this:
>
> var x = 25;
> var fn = function(val){
>   return function(){
>  alert(val);
>   };
> }(x);
> x = 30;
> fn();
>
> The alert will be for 25, rather than 30, as the closure has its own context 
> now for the x variable.
>
> The downside to closures is that handled incorrectly, they can cause memory 
> leaks.
>
> But review of the many articles on the subject will help keep that from 
> happening.
>
> JK
>
>
> -Original Message-
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
> Behalf Of Jan Limpens
> Sent: Saturday, December 13, 2008 2:28 PM
> To: jquery-en@googlegroups.com
> Subject: [jQuery] Re: passing args to a delegate
>
>
> while this might keep the browser from crashing, I wonder what values
> these parameters will have, when the event finally occurs. The ones I
> have passed the very first time? I thought they would have been
> destroyed by then, as we left this scope long ago ...
> But I'll try it out :), thanks!
>
> On Sat, Dec 13, 2008 at 3:22 AM, Mike Nichols  
> wrote:
>>
>> Try this:
>> success: function() { registerImageForms(id,key,type); }
>>
>>
>> On Dec 12, 5:13 pm, "Jan Limpens"  wrote:
>>> Hello,
>>>
>>> I have the following code:
>>>
>>> var registerImageForms = function(id, key, type) {
>>> var sizes = ['small', 'medium', 'large'];
>>> $('#panel-images fieldset:visible').remove();
>>> $.each(sizes, function(i, item) {
>>> var $clonedForm = $('#panel-images fieldset:hidden').clone();
>>> $("legend", $clonedForm).text(item);
>>> $("[name='id']", $clonedForm).val(id);
>>> $("[name='key']", $clonedForm).val(key);
>>> $("[name='type']", $clonedForm).val(type);
>>> $("[name='size']", $clonedForm).val(item);
>>> $("img", $clonedForm).attr('src', "/imagem/article/" + key +
>>> "/" + item + ".png");
>>> $("#panel-images").append($clonedForm);
>>> $("form", $clonedForm).ajaxForm({
>>> success: registerImageForms
>>> });
>>> $clonedForm.show();
>>> });
>>>
>>> };
>>>
>>> Success has no args, so everything is rendered empty, after posting
>>> the form. If I pass arguments as
>>> success: registerImageForms(id, key, type)
>>>
>>> The browser crashes and it makes sense, because at the time this
>>> fires, these identifiers mean nothing. But how do I pass them?
>>>
>>> --
>>> Jan
>
>
>
> --
> Jan
>
>



-- 
Jan


[jQuery] Re: passing args to a delegate

2008-12-13 Thread Jan Limpens

while this might keep the browser from crashing, I wonder what values
these parameters will have, when the event finally occurs. The ones I
have passed the very first time? I thought they would have been
destroyed by then, as we left this scope long ago ...
But I'll try it out :), thanks!

On Sat, Dec 13, 2008 at 3:22 AM, Mike Nichols  wrote:
>
> Try this:
> success: function() { registerImageForms(id,key,type); }
>
>
> On Dec 12, 5:13 pm, "Jan Limpens"  wrote:
>> Hello,
>>
>> I have the following code:
>>
>> var registerImageForms = function(id, key, type) {
>> var sizes = ['small', 'medium', 'large'];
>> $('#panel-images fieldset:visible').remove();
>> $.each(sizes, function(i, item) {
>> var $clonedForm = $('#panel-images fieldset:hidden').clone();
>> $("legend", $clonedForm).text(item);
>> $("[name='id']", $clonedForm).val(id);
>> $("[name='key']", $clonedForm).val(key);
>> $("[name='type']", $clonedForm).val(type);
>> $("[name='size']", $clonedForm).val(item);
>> $("img", $clonedForm).attr('src', "/imagem/article/" + key +
>> "/" + item + ".png");
>> $("#panel-images").append($clonedForm);
>> $("form", $clonedForm).ajaxForm({
>> success: registerImageForms
>> });
>> $clonedForm.show();
>> });
>>
>> };
>>
>> Success has no args, so everything is rendered empty, after posting
>> the form. If I pass arguments as
>> success: registerImageForms(id, key, type)
>>
>> The browser crashes and it makes sense, because at the time this
>> fires, these identifiers mean nothing. But how do I pass them?
>>
>> --
>> Jan



-- 
Jan


[jQuery] passing args to a delegate

2008-12-12 Thread Jan Limpens

Hello,

I have the following code:

var registerImageForms = function(id, key, type) {
var sizes = ['small', 'medium', 'large'];
$('#panel-images fieldset:visible').remove();
$.each(sizes, function(i, item) {
var $clonedForm = $('#panel-images fieldset:hidden').clone();
$("legend", $clonedForm).text(item);
$("[name='id']", $clonedForm).val(id);
$("[name='key']", $clonedForm).val(key);
$("[name='type']", $clonedForm).val(type);
$("[name='size']", $clonedForm).val(item);
$("img", $clonedForm).attr('src', "/imagem/article/" + key +
"/" + item + ".png");
$("#panel-images").append($clonedForm);
$("form", $clonedForm).ajaxForm({
success: registerImageForms
});
$clonedForm.show();
});
};

Success has no args, so everything is rendered empty, after posting
the form. If I pass arguments as
success: registerImageForms(id, key, type)

The browser crashes and it makes sense, because at the time this
fires, these identifiers mean nothing. But how do I pass them?

-- 
Jan


[jQuery] Re: fadeIn something from JSON

2008-12-09 Thread Jan Limpens

@karl: works great! thank you!!

@botondus: that's exactly what I had before that, but then, out of
some reason, the first hover would not show the item at all, only the
second.



On Tue, Dec 9, 2008 at 11:19 AM, botondus <[EMAIL PROTECTED]> wrote:
>
>  Well if you want to fade in something it has to be hidden first. If
> the example with hide() doesn't work, just hide it straight from html.
>
>  $.getJSON(urlForDescription, function(data) {
>$div = $("" + data
> + "");
>$element.after($div).fadeIn();
>});
>
>
> On Dec 9, 12:06 am, "Jan Limpens" <[EMAIL PROTECTED]> wrote:
>> On Mon, Dec 8, 2008 at 7:20 PM, MorningZ <[EMAIL PROTECTED]> wrote:
>> > you'll have to do the fadeIn inside the callback of getJSON
>>
>> var showDescription = function() {
>> $element = $("a.info", this);
>> if ($element.next("div.info").length == 0) {
>> var urlForDescription = $element.attr('href') + '/descricao';
>> $.getJSON(urlForDescription, function(data) {
>> $div = $("" + data + "");
>> $element.after($div).fadeIn();
>> });
>> } else {
>> $element.next("div.info").fadeIn();
>> }
>>
>> }
>>
>> also, just pops up. :(
>>
>> --
>> Jan



-- 
Jan


[jQuery] Re: fadeIn something from JSON

2008-12-08 Thread Jan Limpens

On Mon, Dec 8, 2008 at 7:20 PM, MorningZ <[EMAIL PROTECTED]> wrote:
> you'll have to do the fadeIn inside the callback of getJSON

var showDescription = function() {
$element = $("a.info", this);
if ($element.next("div.info").length == 0) {
var urlForDescription = $element.attr('href') + '/descricao';
$.getJSON(urlForDescription, function(data) {
$div = $("" + data + "");
$element.after($div).fadeIn();
});
} else {
$element.next("div.info").fadeIn();
}
}

also, just pops up. :(


-- 
Jan


[jQuery] fadeIn something from JSON

2008-12-08 Thread Jan Limpens

Hello,

I have got this:
var showDescription = function() {
$element = $("a.info", this);
if ($element.next("div.info").length == 0) {
var urlForDescription = $element.attr('href') + '/description';
$.getJSON(urlForDescription, function(data) {
$div = $("" + data + "");
$element.after($div); // pop! :(
});
}
$element.next("div.info").fadeIn();
}

Problem is, that new descriptions will immediately pop up without
fadeIn. Subsequent hovers will work nicely.
How can I fadeIn this new element? I tried hiding it first (via css
and hide()), but then it did not show up at all (only on subsequent
hovers)...

Any ideas?

-- 
Jan


[jQuery] jquery validation and disabled elements

2008-12-03 Thread Jan Limpens

How can I tell the bassistence validator to ignore disabled inputs?

I have ui.tabs, and only the selected tab's controls are enabled.
I want validation to fire only at them.

-- 
Jan


[jQuery] Re: how to bind a form to json data

2008-10-29 Thread Jan Limpens
I've got something along the lines here. Just wanted to know of a more solid
approach...

On Wed, Oct 29, 2008 at 3:36 PM, Jay <[EMAIL PROTECTED]> wrote:

>
>
>
> On Oct 29, 10:30 am, "Jan Limpens" <[EMAIL PROTECTED]> wrote:
> > hello,
> > then I get from somewhere
> >
> > [{"id":1,"Choice":"two"}]
> >
> > Then the form should get into this state:
> >
> > 
> > 
> > 
> > one
> > two
> > 
> > 
> >
> > Is this implemented somewhere?
>
> not that I know of.
> It's tricky but I think you could do it reasonably quickly using some
> javascript.
> Something like this:
>
> (not tested!)
>
> 
> 
> 
> 
>
> var jsondata = { foo:'x',  bar:'y'  };
> for ( prop in jsondata )
>  document.myform[prop].value = jsondata[prop];
>



-- 
Jan
___
[EMAIL PROTECTED]
www.limpens.com
+55 (11) 3082-1087
+55 (11) 3097-8339


[jQuery] how to bind a form to json data

2008-10-29 Thread Jan Limpens
hello,

I know how to make a form return json, but how can I bind a form to json, so
that all textfields, selects etc. show the correct value?




one
two



then I get from somewhere

[{"id":1,"Choice":"two"}]

Then the form should get into this state:





one
two



Is this implemented somewhere?

-- 
Jan
___
[EMAIL PROTECTED]
www.limpens.com
+55 (11) 3082-1087
+55 (11) 3097-8339


[jQuery] Re: linking two controls

2008-09-17 Thread Jan Limpens

Right now I amusing jqModal for this, but this should not impact too
much on my question.

Right now the work flow is like that:

user clicks on button -->
   - button id is saved in a hidden field
   - dialog is opened and content search form is loaded via ajax
user click search button -->
   - radiobutton list in dialog is populated via ajax
   - list item change event is hooked up, so that it will
   write its value to the input box next() to the item
   which id is in the hidden field
   - dialog is closed

I do not like this because everything crosses so many borders. the
dialogue should have no knowledge about hidden fields (and that some
button has an input field next to it) exterior to it.

It should simply expose an event, the originating button is
subscribing to. or the equivalent in js-speak.

But so far I have not found a way to implement something like that. My
javascript sucks, that's for sure :S

--
Jan


On Wed, Sep 17, 2008 at 7:22 AM, Richard D. Worth <[EMAIL PROTECTED]> wrote:
> I'm not sure if this is exactly what you're looking for, but I wonder if
> you've looked at the jQuery UI Dialog plugin:
>
> Docs:
> http://docs.jquery.com/UI/Dialog
>
> Demos:
> http://ui.jquery.com/repository/latest/demos/functional/#ui.dialog
>
> If it interests you and you have further questions, there's a dedicated
> jQuery UI mailing list:
>
> http://groups.google.com/group/jquery-ui/
>
> - Richard
>
> Richard D. Worth
> http://rdworth.org/
>
> On Tue, Sep 16, 2008 at 2:28 PM, Jan Limpens <[EMAIL PROTECTED]> wrote:
>>
>> ah and by popup i mean something like a modal dialogue on the page,
>> not another browser instance.
>>
>> On Tue, Sep 16, 2008 at 3:22 PM, Jan Limpens <[EMAIL PROTECTED]>
>> wrote:
>> > hello,
>> >
>> > on several pages I have small forms (plural) with a textbox and a
>> > button. If I click on the button, a popup shows a search form. The
>> > results of the searchform are shown in the very same popup as a list
>> > of radiobuttons/labels. If someone selects a radiobutton, it's value
>> > should be inserted into the textbox next to the button. Then the popup
>> > should go away.
>> >
>> > This popup (something like a singleton) serves many different pages,
>> > so I cannot hardwire it. Probably I need to pass a delegate to some
>> > event the form provides, indicating the originating form. Problem is:
>> > I have no idea how something like this can be done. Anyone could give
>> > me a hint or two, or direct me to good resources on similar matters?
>> >
>> > The popup looks like that:
>> >
>> > > > action="${Url.For([EMAIL PROTECTED]:'articles',
>> > @action:'FullTextSearchAsJson'})}">
>> >
>> >
>> > 
>> > 
>> > 
>> >
>> > > > src="/script/jquery-1.2.6.min.js">
>> > 
>> >
>> > 
>> >
>> > $(document).ready(function() {
>> >$('#article-search-form').ajaxForm({
>> >dataType: 'json',
>> >success: fillListWithArticles
>> >});
>> > });
>> >
>> > function fillListWithArticles(data)
>> > {
>> >var list = $("#article-search-result");
>> >$(list).empty();
>> >i = 0;
>> >$.each(data, function(){
>> >id = "article-search-result-" + i;
>> >$("<div><input type='radio' value='"+this.Id+"'
>> > id='"+id+"'
>> > name='article.Id'/><label style='float: inherit' for='"+id+"'>" +
>> > this.Name +"</label></div>").appendTo(list);
>> >i++;
>> >});
>> > }
>> > 
>> >
>> > --
>> > Jan
>> > ___
>> > [EMAIL PROTECTED]
>> > www.limpens.com
>> > +55 (11) 3082-1087
>> > +55 (11) 3097-8339
>> >
>>
>>
>>
>> --
>> Jan
>> ___
>> [EMAIL PROTECTED]
>> www.limpens.com
>> +55 (11) 3082-1087
>> +55 (11) 3097-8339
>
>



-- 
Jan
___
[EMAIL PROTECTED]
www.limpens.com
+55 (11) 3082-1087
+55 (11) 3097-8339


[jQuery] Re: linking two controls

2008-09-16 Thread Jan Limpens

ah and by popup i mean something like a modal dialogue on the page,
not another browser instance.

On Tue, Sep 16, 2008 at 3:22 PM, Jan Limpens <[EMAIL PROTECTED]> wrote:
> hello,
>
> on several pages I have small forms (plural) with a textbox and a
> button. If I click on the button, a popup shows a search form. The
> results of the searchform are shown in the very same popup as a list
> of radiobuttons/labels. If someone selects a radiobutton, it's value
> should be inserted into the textbox next to the button. Then the popup
> should go away.
>
> This popup (something like a singleton) serves many different pages,
> so I cannot hardwire it. Probably I need to pass a delegate to some
> event the form provides, indicating the originating form. Problem is:
> I have no idea how something like this can be done. Anyone could give
> me a hint or two, or direct me to good resources on similar matters?
>
> The popup looks like that:
>
>  action="${Url.For([EMAIL PROTECTED]:'articles',
> @action:'FullTextSearchAsJson'})}">
>
>
> 
> 
> 
>
> 
> 
>
> 
>
> $(document).ready(function() {
>$('#article-search-form').ajaxForm({
>dataType: 'json',
>success: fillListWithArticles
>});
> });
>
> function fillListWithArticles(data)
> {
>var list = $("#article-search-result");
>$(list).empty();
>i = 0;
>$.each(data, function(){
>id = "article-search-result-" + i;
>$("<div><input type='radio' value='"+this.Id+"' id='"+id+"'
> name='article.Id'/><label style='float: inherit' for='"+id+"'>" +
> this.Name +"</label></div>").appendTo(list);
>i++;
>});
> }
> 
>
> --
> Jan
> ___
> [EMAIL PROTECTED]
> www.limpens.com
> +55 (11) 3082-1087
> +55 (11) 3097-8339
>



-- 
Jan
___
[EMAIL PROTECTED]
www.limpens.com
+55 (11) 3082-1087
+55 (11) 3097-8339


[jQuery] linking two controls

2008-09-16 Thread Jan Limpens

hello,

on several pages I have small forms (plural) with a textbox and a
button. If I click on the button, a popup shows a search form. The
results of the searchform are shown in the very same popup as a list
of radiobuttons/labels. If someone selects a radiobutton, it's value
should be inserted into the textbox next to the button. Then the popup
should go away.

This popup (something like a singleton) serves many different pages,
so I cannot hardwire it. Probably I need to pass a delegate to some
event the form provides, indicating the originating form. Problem is:
I have no idea how something like this can be done. Anyone could give
me a hint or two, or direct me to good resources on similar matters?

The popup looks like that:













$(document).ready(function() {
$('#article-search-form').ajaxForm({
dataType: 'json',
success: fillListWithArticles
});
});

function fillListWithArticles(data)
{
var list = $("#article-search-result");
$(list).empty();
i = 0;
$.each(data, function(){
id = "article-search-result-" + i;
$("
").appendTo(list); i++; }); } -- Jan ___ [EMAIL PROTECTED] www.limpens.com +55 (11) 3082-1087 +55 (11) 3097-8339

[jQuery] Re: jqModal callback

2008-06-10 Thread Jan Limpens
Nobody has an idea, what I am doing wrong? Or is the question too
specific / this the wrong place to ask this kind of question?

2008/6/6 Jan Limpens <[EMAIL PROTECTED]>:
> Hello,
>
> I am in the process of writing some scripts that makes use of JqModal
> (http://dev.iceburg.net/jquery/jqModal/).
> What I have to do is the following:
> The web page contains numerous ajax forms that have as their target a modal
> div .
> If the user clicks on the submit button, the response is inserted in the div
> and shown.
>
> Some of the forms contain a hidden select element.
> Once the user clicks on one of those forms' submit button, a dialogue is
> presented (using the very same div).
> It shows the selects contents as a radio list. Once the user has checked a
> radio input, the corresponding option in the select is selected and the form
> is ajax posted as described before.
>
> (Or could this be done simpler?)
>
> But: the confirm method does not break processing: I override confirm, but
> it is simply ignored - the confirmation dialogue blinks only for the
> fraction of a second and the form is submitted as if it would not have been
> there.
>
> var options = {
> target: '#modalWindow',
> beforeSubmit: handleOptions,
> success: function(){
> showModal();
> showCartInfo();
> }
> };
>
> $(function() {
> $('form.buyarticle').ajaxForm(options)
> });
>
> function showModal(){
> return $('#modalWindow').jqmShow();
> }
>
> function showModalWithContent(html){
> return $('#modalWindow').html(html).jqmShow();
> }
>
> function hideModal(){
> return $('#modalWindow').html('').jqmHide();
> }
>
> function handleOptions(formData, jqForm, options)
> {
> var currentSelect = $(jqForm).find("select");
> if (currentSelect!=null && currentSelect.length > 0)
> return confirm(makeSelectMessage(currentSelect),
> callback_SelectResult);
> else
> return true;
> }
>
> function confirm(select,callback) {
> $(showModalWithContent(makeSelectMessage(select)))
> .end()
> .find(':submit:visible')
> .click(function(){
> callback(select);
> hideModal();
> return false; // to prevent the form from posting (does not
> work...)
> });
> }
>
> function callback_SelectResult(select){
> var result = $("#modelWindow :input:checked").eq(0);
> select.selectedIndex = result;
> }
>
> var currentSelect;
>
> function makeSelectMessage(select)
> {
> var msg ="Este produto vem com estas
> variações:";
> msg += "";
> msg += "";
> var i = 0;
> $(select).find("option").each(function(){
> msg += "";
> msg += " id='option_" + i + "'";
> if (i==0)
> msg += " checked='checked'";
> msg += " />";
> msg += $(this).attr("value");
> msg += "";
> i++;
> });
> msg += ""
> msg += "";
> msg += "";
> return msg;
> }
>
> Anyone with more jq experience can tell me what I am doing wrong?
>
> --
> Jan
> ___
> [EMAIL PROTECTED]
> www.limpens.com
> +55 (11) 3082-1087
> +55 (11) 3097-8339



-- 
Jan
___
[EMAIL PROTECTED]
www.limpens.com
+55 (11) 3082-1087
+55 (11) 3097-8339


[jQuery] jqModal callback

2008-06-06 Thread Jan Limpens
Hello,

I am in the process of writing some scripts that makes use of JqModal (
http://dev.iceburg.net/jquery/jqModal/).
What I have to do is the following:
The web page contains numerous ajax forms that have as their target a modal
div .
If the user clicks on the submit button, the response is inserted in the div
and shown.

Some of the forms contain a hidden select element.
Once the user clicks on one of those forms' submit button, a dialogue is
presented (using the very same div).
It shows the selects contents as a radio list. Once the user has checked a
radio input, the corresponding option in the select is selected and the form
is ajax posted as described before.

(Or could this be done simpler?)

But: the confirm method does not break processing: I override confirm, but
it is simply ignored - the confirmation dialogue blinks only for the
fraction of a second and the form is submitted as if it would not have been
there.

var options = {
target: '#modalWindow',
beforeSubmit: handleOptions,
success: function(){
showModal();
showCartInfo();
}
};

$(function() {
$('form.buyarticle').ajaxForm(options)
});

function showModal(){
return $('#modalWindow').jqmShow();
}

function showModalWithContent(html){
return $('#modalWindow').html(html).jqmShow();
}

function hideModal(){
return $('#modalWindow').html('').jqmHide();
}

function handleOptions(formData, jqForm, options)
{
var currentSelect = $(jqForm).find("select");
if (currentSelect!=null && currentSelect.length > 0)
return confirm(makeSelectMessage(currentSelect),
callback_SelectResult);
else
return true;
}

function confirm(select,callback) {
$(showModalWithContent(makeSelectMessage(select)))
.end()
.find(':submit:visible')
.click(function(){
callback(select);
hideModal();
return false; // to prevent the form from posting (does not
work...)
});
}

function callback_SelectResult(select){
var result = $("#modelWindow :input:checked").eq(0);
select.selectedIndex = result;
}

var currentSelect;

function makeSelectMessage(select)
{
var msg ="Este produto vem com estas
variações:";
msg += "";
msg += "";
var i = 0;
$(select).find("option").each(function(){
msg += "";
msg += "";
msg += $(this).attr("value");
msg += "";
i++;
});
msg += ""
msg += "";
msg += "";
return msg;
}

Anyone with more jq experience can tell me what I am doing wrong?

-- 
Jan
___
[EMAIL PROTECTED]
www.limpens.com
+55 (11) 3082-1087
+55 (11) 3097-8339


[jQuery] Re: validate() and multiple forms that arrive via ajax

2008-04-18 Thread Jan Limpens

solution for dynamically loaded, multiple ajax forms with jquery validate:

function setupForm(form, target){
$("input.ajax-invisible").hide();
$(form).validate({ // ataches the validator
currentForm : $(form),
submitHandler: function() { submit(form, target) }
});
}

function submit(form, target){
if ($(target) != null) {
$(form).ajaxSubmit({target: $(target)});
} else {
form.submit();
}
}

On Fri, Apr 18, 2008 at 6:19 PM, Jan Limpens <[EMAIL PROTECTED]> wrote:
> In the meantime I refactored this to:
>
>  function setupForm(form, target){
>
> $("input.ajax-invisible").hide();
> $(form).validate({
> currentForm : $(form)
> });
> if ($(target) != null) {
> $(form).ajaxForm({
> beforeSubmit: function(){$(form).valid()},
> target: $(target)
> });
> }
>  }
>
>  but the problem persists... any help?
>
>
>
>  On Fri, Apr 18, 2008 at 1:06 PM, Jan Limpens <[EMAIL PROTECTED]> wrote:
>  >
>  >  In a wizard I have a container page with a few divs, every div can
>  >  host a certain form, that post it's result to another div. Everything
>  >  via ajax.
>  >  On the bottom of these forms, I call something like this:
>  >  jQuery(function($){
>  > setupAddressForm();
>  >  });
>  >
>  >  which looks like this
>  >  function setupAddressForm(){
>  > var form = setupForm($("#formAddressStep"));
>  > createAjaxContext(form, $("#panelpaymentoption"));
>  >  }
>  >
>  >  function setupForm(form){
>  > $("input.ajax-invisible").hide();
>  > $(form).validate({
>  > submitHandler: function(form) {
>  > $(form).ajaxSubmit();
>  > },
>  > currentForm : form
>  > });
>  > return form;
>  >  }
>  >
>  >  function createAjaxContext(form, nextStep, onSuccess){
>  > form.ajaxForm({
>  > target: nextStep,
>  > success: onSuccess
>  > });
>  >  }
>  >
>  >  But only the very first form is actually validated, Firebug tells me
>  >  that it always remains the currentForm.
>  >
>  >  How can I set subsequent forms to be the currentForm?
>  >
>
>
>
>  --
>  Jan
>  ___
>  [EMAIL PROTECTED]
>  www.limpens.com
>  +55 (11) 3082-1087
>  +55 (11) 3097-8339
>



-- 
Jan
___
[EMAIL PROTECTED]
www.limpens.com
+55 (11) 3082-1087
+55 (11) 3097-8339


[jQuery] Re: validate() and multiple forms that arrive via ajax

2008-04-18 Thread Jan Limpens

In the meantime I refactored this to:

function setupForm(form, target){
$("input.ajax-invisible").hide();
$(form).validate({
currentForm : $(form)
});
if ($(target) != null) {
$(form).ajaxForm({
beforeSubmit: function(){$(form).valid()},
target: $(target)
});
}
}

but the problem persists... any help?

On Fri, Apr 18, 2008 at 1:06 PM, Jan Limpens <[EMAIL PROTECTED]> wrote:
>
>  In a wizard I have a container page with a few divs, every div can
>  host a certain form, that post it's result to another div. Everything
>  via ajax.
>  On the bottom of these forms, I call something like this:
>  jQuery(function($){
> setupAddressForm();
>  });
>
>  which looks like this
>  function setupAddressForm(){
> var form = setupForm($("#formAddressStep"));
> createAjaxContext(form, $("#panelpaymentoption"));
>  }
>
>  function setupForm(form){
> $("input.ajax-invisible").hide();
> $(form).validate({
> submitHandler: function(form) {
> $(form).ajaxSubmit();
> },
> currentForm : form
> });
> return form;
>  }
>
>  function createAjaxContext(form, nextStep, onSuccess){
> form.ajaxForm({
> target: nextStep,
> success: onSuccess
> });
>  }
>
>  But only the very first form is actually validated, Firebug tells me
>  that it always remains the currentForm.
>
>  How can I set subsequent forms to be the currentForm?
>



-- 
Jan
___
[EMAIL PROTECTED]
www.limpens.com
+55 (11) 3082-1087
+55 (11) 3097-8339


[jQuery] validate() and multiple forms that arrive via ajax

2008-04-18 Thread Jan Limpens

In a wizard I have a container page with a few divs, every div can
host a certain form, that post it's result to another div. Everything
via ajax.
On the bottom of these forms, I call something like this:
jQuery(function($){
setupAddressForm();
});

which looks like this
function setupAddressForm(){
var form = setupForm($("#formAddressStep"));
createAjaxContext(form, $("#panelpaymentoption"));
}

function setupForm(form){
$("input.ajax-invisible").hide();
$(form).validate({
submitHandler: function(form) {
$(form).ajaxSubmit();
},
currentForm : form
});
return form;
}

function createAjaxContext(form, nextStep, onSuccess){
form.ajaxForm({
target: nextStep,
success: onSuccess
});
}

But only the very first form is actually validated, Firebug tells me
that it always remains the currentForm.

How can I set subsequent forms to be the currentForm?