calling screen from javascript

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

calling screen from javascript

S.Hage
Hi all,

How I can call a screen from javascript like this:

function xyz(){
...

 ${screens.render("component://common/widget/CommonScreens.xml#states")};
.
.
.

}

thanks in advance.
Reply | Threaded
Open this post in threaded view
|

Re: calling screen from javascript

BJ Freeman
unless things changed lately all calls go through the controller.

=========================
BJ Freeman
Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
Specialtymarket.com  <http://www.specialtymarket.com/>
Systems Integrator-- Glad to Assist

Chat  Y! messenger: bjfr33man


S.Hage sent the following on 2/6/2011 5:58 PM:

>
> Hi all,
>
> How I can call a screen from javascript like this:
>
> function xyz(){
> ...
>
>   ${screens.render("component://common/widget/CommonScreens.xml#states")};
> .
> .
> .
>
> }
>
> thanks in advance.
>

Reply | Threaded
Open this post in threaded view
|

Re: calling screen from javascript

S.Hage
In reply to this post by S.Hage

when I us this ${screens.render("component://common/widget/CommonScreens.xml#states")}; in javascript function I got this error:

Error: missing ; before statement
Source File: https://localhost:8443/cccc/control/MyNewCustomer
Line: 1771, Column: 5
Source Code:
    <option value='IT-AG'>Agrigento</option> 


Any idea?

thanks
Reply | Threaded
Open this post in threaded view
|

Re: calling screen from javascript

Atul Vani
In reply to this post by BJ Freeman
I am not sure why you want to do that, but for the code below to work
that will need to be placed in an ftl (inside script tags).

On Monday 07 February 2011 07:41 AM, BJ Freeman wrote:

> unless things changed lately all calls go through the controller.
>
> =========================
> BJ Freeman
> Strategic Power Office with Supplier Automation
> <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
> Specialtymarket.com <http://www.specialtymarket.com/>
> Systems Integrator-- Glad to Assist
>
> Chat  Y! messenger: bjfr33man
>
>
> S.Hage sent the following on 2/6/2011 5:58 PM:
>>
>> Hi all,
>>
>> How I can call a screen from javascript like this:
>>
>> function xyz(){
>> ...
>>
>>  
>> ${screens.render("component://common/widget/CommonScreens.xml#states")};
>> .
>> .
>> .
>>
>> }
>>
>> thanks in advance.
--
Thanks&  Regards
Atul Vani
Enterprise Software Developer
HotWax Media Pvt. Ltd.
http://www.hotwaxmedia.com/
We are the Global Leaders in Apache OFBiz, Google 'ofbiz' and see for yourself.

Reply | Threaded
Open this post in threaded view
|

Re: calling screen from javascript

Atul Vani
In reply to this post by S.Hage
Not sure. Try something from here
http://freemarker.sourceforge.net/docs/ref_builtins_string.html

Better to find some other way to address it.

On Monday 07 February 2011 08:27 AM, S.Hage wrote:

>
> when I us this
> ${screens.render("component://common/widget/CommonScreens.xml#states")}; in
> javascript function I got this error:
>
> Error: missing ; before statement
> Source File: https://localhost:8443/cccc/control/MyNewCustomer
> Line: 1771, Column: 5
> Source Code:
>      <option value='IT-AG'>Agrigento</option>
>
>
> Any idea?
>
> thanks
>    
--
Thanks&  Regards
Atul Vani
Enterprise Software Developer
HotWax Media Pvt. Ltd.
http://www.hotwaxmedia.com/
We are the Global Leaders in Apache OFBiz, Google 'ofbiz' and see for yourself.

Reply | Threaded
Open this post in threaded view
|

Re: calling screen from javascript

BJ Freeman
In reply to this post by S.Hage
where are you running this script.
this can only be run on the non UI side
to my knowledge JS is not supported on that side.
component://common/widget/CommonScreens.xml#states
can not be called on a rendered page.

=========================
BJ Freeman
Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
Specialtymarket.com  <http://www.specialtymarket.com/>
Systems Integrator-- Glad to Assist

Chat  Y! messenger: bjfr33man
S.Hage sent the following on 2/6/2011 6:57 PM:

>
>
> when I us this
> ${screens.render("component://common/widget/CommonScreens.xml#states")}; in
> javascript function I got this error:
>
> Error: missing ; before statement
> Source File: https://localhost:8443/cccc/control/MyNewCustomer
> Line: 1771, Column: 5
> Source Code:
>      <option value='IT-AG'>Agrigento</option>
>
>
> Any idea?
>
> thanks
Reply | Threaded
Open this post in threaded view
|

Re: calling screen from javascript

S.Hage

Well, what I want to do, I created my own 'Create Party User Interface' using javascript + DOM (in .ftl file), and its not exactly the same create party in OFBiz. But in some places in the code I want to use what is already done in ofbiz like states and country, I found in many place in the code the '${screens.render("component://common/widget/CommonScreens.xml#states")}; ' is used, and I thought its easy to incorporate it into my javascript + DOM function.



 
Reply | Threaded
Open this post in threaded view
|

Re: calling screen from javascript

BJ Freeman
if I understand you are including JS in an fTL.
this will only be activated after the ftl has been rendered.
FTL are not like a PHP or ASP page. it is put through a renderer code
that changes it to html
so only the information rendered on the resultant html page will be
available. at that time
${screens.render("component://common/widget/CommonScreens.xml#states")
has already been rendered.
the only DOM available is the web page in html.

hope that makes sense

=========================
BJ Freeman
Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
Specialtymarket.com  <http://www.specialtymarket.com/>
Systems Integrator-- Glad to Assist

Chat  Y! messenger: bjfr33man


S.Hage sent the following on 2/7/2011 12:54 PM:

>
>
> Well, what I want to do, I created my own 'Create Party User Interface'
> using javascript + DOM (in .ftl file), and its not exactly the same create
> party in OFBiz. But in some places in the code I want to use what is already
> done in ofbiz like states and country, I found in many place in the code the
> '${screens.render("component://common/widget/CommonScreens.xml#states")};'
> is used, and I thought its easy to incorporate it into my javascript + DOM
> function.
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: calling screen from javascript

James McGill-5
In reply to this post by S.Hage
On Sun, Feb 6, 2011 at 6:58 PM, S.Hage <[hidden email]> wrote:

>
> Hi all,
>
> How I can call a screen from javascript like this:
>
> function xyz(){
> ...
>
>  ${screens.render("component://common/widget/CommonScreens.xml#states")};
> .

The closest you can get to this is to make an ajax call to a
controller request that renders a screen, and then put this content
into your current document.  You will have trouble if the screen
result has decorators or if it contains scripts.

A better, simpler plan is to render your initial screen with divs set
aside for the purpose of injecting dynamic content.  Then you can
simply call a controller request that runs a service but renders no
view, let Javascript get the service output as JSON, and update your
screen this way.



James McGill
Phoenix AZ