Named PTAjax calls

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Named PTAjax calls

Aaron Rosenzweig-2
Hello,

Is there a way to “name” a PTAjax callback so that it can be conveniently invoked from javascript?

Situation:
Want to effectively have a submit button (or hyperlink) on the page with an on click Updater callback… then from something programmatically on the page… *click* that link.

Problems:
1) Having a hidden button or link to click is not elegant (I feel dirty)

2) It doesn’t always work. For various reasons, doing a domElement.click() is not the same as a human hand doing a click because it doesn’t generate a full mouse click event.

Thought:
There must be a way to setup the following:
A) Create a PTAjax object with a name that is a global javascript variable on the client side (web browser)

B) You would provide the “javascript function name” a “seaside callback” a “HTML form ID or form name” so that synchronization of form variables can take place and finally an “update container ID”

C) You could just invoke it from your javascript code and know that it will safely update the server.

Does this make sense?
Aaron Rosenzweig / Chat 'n Bike
e:  [hidden email]  t:  (301) 956-2319
Chat 'n Bike Chat 'n Bike


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Named PTAjax calls

Aaron Rosenzweig-2
Oh c’mon, no takers?

Nobody has faced this before?

I can’t believe something so easy in WebObjects is so hard in Seaside. (Ok, that was below the belt). 

In WO, all I have to do is drop an “AjaxWOSubmitButton” component on the page and then bind the “functionName” binding. I can immediately call that name in Javascript from the client side and anything in the “action” binding is performed and all the form bindings are synchronized. 

Thanks,
Aaron Rosenzweig / Chat 'n Bike
e:  [hidden email]  t:  (301) 956-2319
Chat 'n Bike Chat 'n Bike

On Dec 15, 2013, at 9:50 AM, Aaron Rosenzweig <[hidden email]> wrote:

Hello,

Is there a way to “name” a PTAjax callback so that it can be conveniently invoked from javascript?

Situation:
Want to effectively have a submit button (or hyperlink) on the page with an on click Updater callback… then from something programmatically on the page… *click* that link.

Problems:
1) Having a hidden button or link to click is not elegant (I feel dirty)

2) It doesn’t always work. For various reasons, doing a domElement.click() is not the same as a human hand doing a click because it doesn’t generate a full mouse click event.

Thought:
There must be a way to setup the following:
A) Create a PTAjax object with a name that is a global javascript variable on the client side (web browser)

B) You would provide the “javascript function name” a “seaside callback” a “HTML form ID or form name” so that synchronization of form variables can take place and finally an “update container ID”

C) You could just invoke it from your javascript code and know that it will safely update the server.

Does this make sense?
Aaron Rosenzweig / Chat 'n Bike
e:  [hidden email]  t:  (301) 956-2319
Chat 'n Bike Chat 'n Bike



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Named PTAjax calls

Bob Arning-2
I certainly won't say this is the right way, but it seems to work:

renderGlobalSearchOn: html

    | inputId action |
   
    inputId _ html nextId.
    action _ html jQuery ajax
        callback: [ :v2 |
            filterString _ v2.
            selections _ Dictionary new.
            visibleChunks _ #().
        ]
        value: (html jQuery id: inputId) value;

        script: self scriptForGlobalSearch.
           
    html script: 'function foobar27(){',action greaseString,'}'.
   
    html div: [
        html button
            value: 'Search:';
            onClick: 'foobar27()';
            yourself.
        html textInput
            id: inputId;
            value: filterString;
            onEnter: 'foobar27()'.
    ].


Cheers,
Bob

On 12/16/13 8:25 PM, Aaron Rosenzweig wrote:
Oh c’mon, no takers?

Nobody has faced this before?

I can’t believe something so easy in WebObjects is so hard in Seaside. (Ok, that was below the belt). 

In WO, all I have to do is drop an “AjaxWOSubmitButton” component on the page and then bind the “functionName” binding. I can immediately call that name in Javascript from the client side and anything in the “action” binding is performed and all the form bindings are synchronized. 

Thanks,
Aaron Rosenzweig / Chat 'n Bike
e:  [hidden email]  t:  (301) 956-2319
Chat 'n Bike Chat 'n Bike

On Dec 15, 2013, at 9:50 AM, Aaron Rosenzweig <[hidden email]> wrote:

Hello,

Is there a way to “name” a PTAjax callback so that it can be conveniently invoked from javascript?

Situation:
Want to effectively have a submit button (or hyperlink) on the page with an on click Updater callback… then from something programmatically on the page… *click* that link.

Problems:
1) Having a hidden button or link to click is not elegant (I feel dirty)

2) It doesn’t always work. For various reasons, doing a domElement.click() is not the same as a human hand doing a click because it doesn’t generate a full mouse click event.

Thought:
There must be a way to setup the following:
A) Create a PTAjax object with a name that is a global javascript variable on the client side (web browser)

B) You would provide the “javascript function name” a “seaside callback” a “HTML form ID or form name” so that synchronization of form variables can take place and finally an “update container ID”

C) You could just invoke it from your javascript code and know that it will safely update the server.

Does this make sense?
Aaron Rosenzweig / Chat 'n Bike
e:  [hidden email]  t:  (301) 956-2319
Chat 'n Bike Chat 'n Bike




_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Named PTAjax calls

Aaron Rosenzweig-2
Hi Bob,

Ahh ok. It took me a while to wrap my head around it but that’s clever.

Basically you declared the “action” variable and then assigned it an Ajax object. Though I don’t understand the underscores in the syntax.

Then, in the end, you make a javascript function and pass in the “action” variable’s guts but giving it the “greaseString” message.

Thank you Bob - you were the only one to respond. I appreciate it! :-)
Aaron Rosenzweig / Chat 'n Bike
e:  [hidden email]  t:  (301) 956-2319
Chat 'n Bike Chat 'n Bike

On Dec 17, 2013, at 6:24 AM, Bob Arning <[hidden email]> wrote:

I certainly won't say this is the right way, but it seems to work:

renderGlobalSearchOn: html

    | inputId action |
   
    inputId _ html nextId.
    action _ html jQuery ajax
        callback: [ :v2 |
            filterString _ v2.
            selections _ Dictionary new.
            visibleChunks _ #().
        ]
        value: (html jQuery id: inputId) value;

        script: self scriptForGlobalSearch.
           
    html script: 'function foobar27(){',action greaseString,'}'.
   
    html div: [
        html button
            value: 'Search:';
            onClick: 'foobar27()';
            yourself.
        html textInput
            id: inputId;
            value: filterString;
            onEnter: 'foobar27()'.
    ].


Cheers,
Bob

On 12/16/13 8:25 PM, Aaron Rosenzweig wrote:
Oh c’mon, no takers?

Nobody has faced this before?

I can’t believe something so easy in WebObjects is so hard in Seaside. (Ok, that was below the belt). 

In WO, all I have to do is drop an “AjaxWOSubmitButton” component on the page and then bind the “functionName” binding. I can immediately call that name in Javascript from the client side and anything in the “action” binding is performed and all the form bindings are synchronized. 

Thanks,
Aaron Rosenzweig / Chat 'n Bike
e:  [hidden email]  t:  (301) 956-2319
Chat 'n Bike Chat 'n Bike

On Dec 15, 2013, at 9:50 AM, Aaron Rosenzweig <[hidden email]> wrote:

Hello,

Is there a way to “name” a PTAjax callback so that it can be conveniently invoked from javascript?

Situation:
Want to effectively have a submit button (or hyperlink) on the page with an on click Updater callback… then from something programmatically on the page… *click* that link.

Problems:
1) Having a hidden button or link to click is not elegant (I feel dirty)

2) It doesn’t always work. For various reasons, doing a domElement.click() is not the same as a human hand doing a click because it doesn’t generate a full mouse click event.

Thought:
There must be a way to setup the following:
A) Create a PTAjax object with a name that is a global javascript variable on the client side (web browser)

B) You would provide the “javascript function name” a “seaside callback” a “HTML form ID or form name” so that synchronization of form variables can take place and finally an “update container ID”

C) You could just invoke it from your javascript code and know that it will safely update the server.

Does this make sense?
Aaron Rosenzweig / Chat 'n Bike
e:  [hidden email]  t:  (301) 956-2319
Chat 'n Bike Chat 'n Bike




_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Named PTAjax calls

Bob Arning-2

On 12/18/13 6:09 PM, Aaron Rosenzweig wrote:
Hi Bob,

Ahh ok. It took me a while to wrap my head around it but that’s clever.

Basically you declared the “action” variable and then assigned it an Ajax object.
Right - that assignment predated your request. I did that so I could use the same code for both the onClick: and the onEnter:. It used to read "onClick: action" and "onEnter: action". Similar to what you were wanting to do - use the same callback in a number of places.
Though I don’t understand the underscores in the syntax.
old-school assignment (equivalent to colon-equal)

Then, in the end, you make a javascript function and pass in the “action” variable’s guts but giving it the “greaseString” message.

Thank you Bob - you were the only one to respond. I appreciate it! :-)
Aaron Rosenzweig / Chat 'n Bike
e:  [hidden email]  t:  (301) 956-2319
Chat 'n Bike Chat 'n Bike

On Dec 17, 2013, at 6:24 AM, Bob Arning <[hidden email]> wrote:

I certainly won't say this is the right way, but it seems to work:

renderGlobalSearchOn: html

    | inputId action |
   
    inputId _ html nextId.
    action _ html jQuery ajax
        callback: [ :v2 |
            filterString _ v2.
            selections _ Dictionary new.
            visibleChunks _ #().
        ]
        value: (html jQuery id: inputId) value;

        script: self scriptForGlobalSearch.
           
    html script: 'function foobar27(){',action greaseString,'}'.
   
    html div: [
        html button
            value: 'Search:';
            onClick: 'foobar27()';
            yourself.
        html textInput
            id: inputId;
            value: filterString;
            onEnter: 'foobar27()'.
    ].


Cheers,
Bob

On 12/16/13 8:25 PM, Aaron Rosenzweig wrote:
Oh c’mon, no takers?

Nobody has faced this before?

I can’t believe something so easy in WebObjects is so hard in Seaside. (Ok, that was below the belt). 

In WO, all I have to do is drop an “AjaxWOSubmitButton” component on the page and then bind the “functionName” binding. I can immediately call that name in Javascript from the client side and anything in the “action” binding is performed and all the form bindings are synchronized. 

Thanks,
Aaron Rosenzweig / Chat 'n Bike
e:  [hidden email]  t:  (301) 956-2319
Chat 'n Bike Chat 'n Bike

On Dec 15, 2013, at 9:50 AM, Aaron Rosenzweig <[hidden email]> wrote:

Hello,

Is there a way to “name” a PTAjax callback so that it can be conveniently invoked from javascript?

Situation:
Want to effectively have a submit button (or hyperlink) on the page with an on click Updater callback… then from something programmatically on the page… *click* that link.

Problems:
1) Having a hidden button or link to click is not elegant (I feel dirty)

2) It doesn’t always work. For various reasons, doing a domElement.click() is not the same as a human hand doing a click because it doesn’t generate a full mouse click event.

Thought:
There must be a way to setup the following:
A) Create a PTAjax object with a name that is a global javascript variable on the client side (web browser)

B) You would provide the “javascript function name” a “seaside callback” a “HTML form ID or form name” so that synchronization of form variables can take place and finally an “update container ID”

C) You could just invoke it from your javascript code and know that it will safely update the server.

Does this make sense?
Aaron Rosenzweig / Chat 'n Bike
e:  [hidden email]  t:  (301) 956-2319
Chat 'n Bike Chat 'n Bike




_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Named PTAjax calls

Johan Brichau-2
The Javascript wrappers in Seaside (JSObject subclasses) provide a number of convenience methods to achieve this.
For example:

html script: ((html jQuery ajax callback:[ ]) asFunction assignTo: 'myfunction').

Then just call myfunction() from your javascripts.

cheers
Johan

On 19 Dec 2013, at 00:25, Bob Arning <[hidden email]> wrote:

>
> On 12/18/13 6:09 PM, Aaron Rosenzweig wrote:
>> Hi Bob,
>>
>> Ahh ok. It took me a while to wrap my head around it but that’s clever.
>>
>> Basically you declared the “action” variable and then assigned it an Ajax object.
> Right - that assignment predated your request. I did that so I could use the same code for both the onClick: and the onEnter:. It used to read "onClick: action" and "onEnter: action". Similar to what you were wanting to do - use the same callback in a number of places.
>> Though I don’t understand the underscores in the syntax.
> old-school assignment (equivalent to colon-equal)
>>
>> Then, in the end, you make a javascript function and pass in the “action” variable’s guts but giving it the “greaseString” message.
>>
>> Thank you Bob - you were the only one to respond. I appreciate it! :-)
>> AARON ROSENZWEIG / Chat 'n Bike
>> e:  [hidden email]  t:  (301) 956-2319                
>>
>> On Dec 17, 2013, at 6:24 AM, Bob Arning <[hidden email]> wrote:
>>
>>> I certainly won't say this is the right way, but it seems to work:
>>>
>>> renderGlobalSearchOn: html
>>>
>>>     | inputId action |
>>>    
>>>     inputId _ html nextId.
>>>     action _ html jQuery ajax
>>>         callback: [ :v2 |
>>>             filterString _ v2.
>>>             selections _ Dictionary new.
>>>             visibleChunks _ #().
>>>         ]
>>>         value: (html jQuery id: inputId) value;
>>>
>>>         script: self scriptForGlobalSearch.
>>>            
>>>     html script: 'function foobar27(){',action greaseString,'}'.
>>>    
>>>     html div: [
>>>         html button
>>>             value: 'Search:';
>>>             onClick: 'foobar27()';
>>>             yourself.
>>>         html textInput
>>>             id: inputId;
>>>             value: filterString;
>>>             onEnter: 'foobar27()'.
>>>     ].
>>>
>>>
>>> Cheers,
>>> Bob
>>>
>>> On 12/16/13 8:25 PM, Aaron Rosenzweig wrote:
>>>> Oh c’mon, no takers?
>>>>
>>>> Nobody has faced this before?
>>>>
>>>> I can’t believe something so easy in WebObjects is so hard in Seaside. (Ok, that was below the belt).
>>>>
>>>> In WO, all I have to do is drop an “AjaxWOSubmitButton” component on the page and then bind the “functionName” binding. I can immediately call that name in Javascript from the client side and anything in the “action” binding is performed and all the form bindings are synchronized.
>>>>
>>>> Thanks,
>>>> AARON ROSENZWEIG / Chat 'n Bike
>>>> e:  [hidden email]  t:  (301) 956-2319
>>>>
>>>> On Dec 15, 2013, at 9:50 AM, Aaron Rosenzweig <[hidden email]> wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> Is there a way to “name” a PTAjax callback so that it can be conveniently invoked from javascript?
>>>>>
>>>>> Situation:
>>>>> Want to effectively have a submit button (or hyperlink) on the page with an on click Updater callback… then from something programmatically on the page… *click* that link.
>>>>>
>>>>> Problems:
>>>>> 1) Having a hidden button or link to click is not elegant (I feel dirty)
>>>>>
>>>>> 2) It doesn’t always work. For various reasons, doing a domElement.click() is not the same as a human hand doing a click because it doesn’t generate a full mouse click event.
>>>>>
>>>>> Thought:
>>>>> There must be a way to setup the following:
>>>>> A) Create a PTAjax object with a name that is a global javascript variable on the client side (web browser)
>>>>>
>>>>> B) You would provide the “javascript function name” a “seaside callback” a “HTML form ID or form name” so that synchronization of form variables can take place and finally an “update container ID”
>>>>>
>>>>> C) You could just invoke it from your javascript code and know that it will safely update the server.
>>>>>
>>>>> Does this make sense?
>>>>> AARON ROSENZWEIG / Chat 'n Bike
>>>>> e:  [hidden email]  t:  (301) 956-2319
>>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> seaside mailing list
>>>>
>>>> [hidden email]
>>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>
>>> _______________________________________________
>>> seaside mailing list
>>> [hidden email]
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Named PTAjax calls

Bob Arning-2
Hehe, one reason I answered was to nudge someone to post the right answer. I looked at some of the function stuff, but didn't see how to give it a name. Thanks.

Cheers,
Bob


On 12/18/13 7:07 PM, Johan Brichau wrote:
The Javascript wrappers in Seaside (JSObject subclasses) provide a number of convenience methods to achieve this.
For example:

html script: ((html jQuery ajax callback:[ ]) asFunction assignTo: 'myfunction').

Then just call myfunction() from your javascripts.

cheers
Johan

On 19 Dec 2013, at 00:25, Bob Arning [hidden email] wrote:

On 12/18/13 6:09 PM, Aaron Rosenzweig wrote:
Hi Bob,

Ahh ok. It took me a while to wrap my head around it but that’s clever.

Basically you declared the “action” variable and then assigned it an Ajax object.
Right - that assignment predated your request. I did that so I could use the same code for both the onClick: and the onEnter:. It used to read "onClick: action" and "onEnter: action". Similar to what you were wanting to do - use the same callback in a number of places.
Though I don’t understand the underscores in the syntax.
old-school assignment (equivalent to colon-equal)
Then, in the end, you make a javascript function and pass in the “action” variable’s guts but giving it the “greaseString” message.

Thank you Bob - you were the only one to respond. I appreciate it! :-)
AARON ROSENZWEIG / Chat 'n Bike
e:  [hidden email]  t:  (301) 956-2319                 
	
On Dec 17, 2013, at 6:24 AM, Bob Arning [hidden email] wrote:

I certainly won't say this is the right way, but it seems to work:

renderGlobalSearchOn: html

    | inputId action |
    
    inputId _ html nextId.
    action _ html jQuery ajax 
        callback: [ :v2 | 
            filterString _ v2.
            selections _ Dictionary new.
            visibleChunks _ #().
        ] 
        value: (html jQuery id: inputId) value;

        script: self scriptForGlobalSearch.
            
    html script: 'function foobar27(){',action greaseString,'}'.
    
    html div: [
        html button
            value: 'Search:';
            onClick: 'foobar27()';
            yourself.
        html textInput
            id: inputId;
            value: filterString;
            onEnter: 'foobar27()'.
    ].


Cheers,
Bob

On 12/16/13 8:25 PM, Aaron Rosenzweig wrote:
Oh c’mon, no takers?

Nobody has faced this before?

I can’t believe something so easy in WebObjects is so hard in Seaside. (Ok, that was below the belt). 

In WO, all I have to do is drop an “AjaxWOSubmitButton” component on the page and then bind the “functionName” binding. I can immediately call that name in Javascript from the client side and anything in the “action” binding is performed and all the form bindings are synchronized. 

Thanks,
AARON ROSENZWEIG / Chat 'n Bike
e:  [hidden email]  t:  (301) 956-2319 
	
On Dec 15, 2013, at 9:50 AM, Aaron Rosenzweig [hidden email] wrote:

Hello,

Is there a way to “name” a PTAjax callback so that it can be conveniently invoked from javascript?

Situation:
Want to effectively have a submit button (or hyperlink) on the page with an on click Updater callback… then from something programmatically on the page… *click* that link.

Problems:
1) Having a hidden button or link to click is not elegant (I feel dirty)

2) It doesn’t always work. For various reasons, doing a domElement.click() is not the same as a human hand doing a click because it doesn’t generate a full mouse click event.

Thought:
There must be a way to setup the following:
A) Create a PTAjax object with a name that is a global javascript variable on the client side (web browser)

B) You would provide the “javascript function name” a “seaside callback” a “HTML form ID or form name” so that synchronization of form variables can take place and finally an “update container ID”

C) You could just invoke it from your javascript code and know that it will safely update the server.

Does this make sense?
AARON ROSENZWEIG / Chat 'n Bike
e:  [hidden email]  t:  (301) 956-2319 
	


_______________________________________________
seaside mailing list

[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

        
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Named PTAjax calls

Aaron Rosenzweig-2
Aha!

Thanks Johan and Bob. Very nice advice, that’s what I was looking for :-)

So this works for a “link” but what about a form? How do you specify which form to submit in the process and have all the form fields synchronize their variables?

Thank you,
Aaron Rosenzweig / Chat 'n Bike
e:  [hidden email]  t:  (301) 956-2319
Chat 'n Bike Chat 'n Bike

On Dec 18, 2013, at 7:34 PM, Bob Arning <[hidden email]> wrote:

Hehe, one reason I answered was to nudge someone to post the right answer. I looked at some of the function stuff, but didn't see how to give it a name. Thanks.

Cheers,
Bob


On 12/18/13 7:07 PM, Johan Brichau wrote:
The Javascript wrappers in Seaside (JSObject subclasses) provide a number of convenience methods to achieve this.
For example:

html script: ((html jQuery ajax callback:[ ]) asFunction assignTo: 'myfunction').

Then just call myfunction() from your javascripts.

cheers
Johan

On 19 Dec 2013, at 00:25, Bob Arning [hidden email] wrote:

On 12/18/13 6:09 PM, Aaron Rosenzweig wrote:
Hi Bob,

Ahh ok. It took me a while to wrap my head around it but that’s clever.

Basically you declared the “action” variable and then assigned it an Ajax object.
Right - that assignment predated your request. I did that so I could use the same code for both the onClick: and the onEnter:. It used to read "onClick: action" and "onEnter: action". Similar to what you were wanting to do - use the same callback in a number of places.
Though I don’t understand the underscores in the syntax.
old-school assignment (equivalent to colon-equal)
Then, in the end, you make a javascript function and pass in the “action” variable’s guts but giving it the “greaseString” message.

Thank you Bob - you were the only one to respond. I appreciate it! :-)
AARON ROSENZWEIG / Chat 'n Bike
e:  [hidden email]  t:  (301) 956-2319                 
	
On Dec 17, 2013, at 6:24 AM, Bob Arning [hidden email] wrote:

I certainly won't say this is the right way, but it seems to work:

renderGlobalSearchOn: html

    | inputId action |
    
    inputId _ html nextId.
    action _ html jQuery ajax 
        callback: [ :v2 | 
            filterString _ v2.
            selections _ Dictionary new.
            visibleChunks _ #().
        ] 
        value: (html jQuery id: inputId) value;

        script: self scriptForGlobalSearch.
            
    html script: 'function foobar27(){',action greaseString,'}'.
    
    html div: [
        html button
            value: 'Search:';
            onClick: 'foobar27()';
            yourself.
        html textInput
            id: inputId;
            value: filterString;
            onEnter: 'foobar27()'.
    ].


Cheers,
Bob

On 12/16/13 8:25 PM, Aaron Rosenzweig wrote:
Oh c’mon, no takers?

Nobody has faced this before?

I can’t believe something so easy in WebObjects is so hard in Seaside. (Ok, that was below the belt). 

In WO, all I have to do is drop an “AjaxWOSubmitButton” component on the page and then bind the “functionName” binding. I can immediately call that name in Javascript from the client side and anything in the “action” binding is performed and all the form bindings are synchronized. 

Thanks,
AARON ROSENZWEIG / Chat 'n Bike
e:  [hidden email]  t:  (301) 956-2319 
	
On Dec 15, 2013, at 9:50 AM, Aaron Rosenzweig [hidden email] wrote:

Hello,

Is there a way to “name” a PTAjax callback so that it can be conveniently invoked from javascript?

Situation:
Want to effectively have a submit button (or hyperlink) on the page with an on click Updater callback… then from something programmatically on the page… *click* that link.

Problems:
1) Having a hidden button or link to click is not elegant (I feel dirty)

2) It doesn’t always work. For various reasons, doing a domElement.click() is not the same as a human hand doing a click because it doesn’t generate a full mouse click event.

Thought:
There must be a way to setup the following:
A) Create a PTAjax object with a name that is a global javascript variable on the client side (web browser)

B) You would provide the “javascript function name” a “seaside callback” a “HTML form ID or form name” so that synchronization of form variables can take place and finally an “update container ID”

C) You could just invoke it from your javascript code and know that it will safely update the server.

Does this make sense?
AARON ROSENZWEIG / Chat 'n Bike
e:  [hidden email]  t:  (301) 956-2319 
	

_______________________________________________
seaside mailing list

[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

        
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside