Hello All:
Is this possible? Set a screen widget include screen or field value in the Bean Shell (dynamically) and then have it available to use in the screen widget? For example, in the Bean Shell I say something like: context.put("screen_name", "ascreen"); In the screen widget defintion I want to: <set field="some_screen_name" value= [this is the value from the Bean Shell = "screen_name" = ascreen] /> or even <include-screen name="${????}" ...> (so that ???? is resolved to ascreen)? TIA Ruth _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
Yes, this is fairly easy. The steps:
1. From your bsh script, put the screen name and location of the screen name in the context: context.put("screen_name", "something"); context.put("screen_location", "component://path/to/screen.xml"); 2. Call this script in the actions of the parent screen that does the<include-screen> <screen> <section> <actions><script location="path/to/bsh/script.bsh"/></actions> 3. The context is available to the contents of the <widgets> element, so you can immediately do this, <widgets> <include-screen name="${screen_name}" location="${screen_location}" </widgets> </section> </screen> Ruth Hoffman wrote: > Hello All: > > Is this possible? > Set a screen widget include screen or field value in the Bean Shell > (dynamically) and then have it available to use in the screen widget? > For example, in the Bean Shell I say something like: > > context.put("screen_name", "ascreen"); > > In the screen widget defintion I want to: > > <set field="some_screen_name" value= [this is the value from the Bean > Shell = "screen_name" = ascreen] /> or even > > <include-screen name="${????}" ...> (so that ???? is resolved to ascreen)? > > TIA > Ruth > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users > _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
Ah, thanks Leon.
It didn't even occur to me to give a screen_location. Is there any way to print out log statements from the screen widget xml file as it is building the screens? Since there were no error messages thrown while the screen was being built, I had no way of knowing why screen values set in bsh weren't being found. Thanks again, Ruth Leon Torres wrote: >Yes, this is fairly easy. The steps: > >1. From your bsh script, put the screen name and location of the screen name in >the context: > > context.put("screen_name", "something"); > context.put("screen_location", "component://path/to/screen.xml"); > >2. Call this script in the actions of the parent screen that does >the<include-screen> > ><screen> > <section> > <actions><script location="path/to/bsh/script.bsh"/></actions> > >3. The context is available to the contents of the <widgets> element, so you >can immediately do this, > > <widgets> > <include-screen name="${screen_name}" location="${screen_location}" > </widgets> > </section> ></screen> > > >Ruth Hoffman wrote: > > >>Hello All: >> >>Is this possible? >>Set a screen widget include screen or field value in the Bean Shell >>(dynamically) and then have it available to use in the screen widget? >>For example, in the Bean Shell I say something like: >> >>context.put("screen_name", "ascreen"); >> >>In the screen widget defintion I want to: >> >><set field="some_screen_name" value= [this is the value from the Bean >>Shell = "screen_name" = ascreen] /> or even >> >><include-screen name="${????}" ...> (so that ???? is resolved to ascreen)? >> >>TIA >>Ruth >> >>_______________________________________________ >>Users mailing list >>[hidden email] >>http://lists.ofbiz.org/mailman/listinfo/users >> >> >> > >_______________________________________________ >Users mailing list >[hidden email] >http://lists.ofbiz.org/mailman/listinfo/users > > > _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
Free forum by Nabble | Edit this page |