Dynamic definition of binding expression.

I can use a standard textInput like this:
<mx:TextInput   text="{Root.elementA}" \>
and this works well, when I use an HttpService to replace Root, the TextInput is updated.  However...
I have defined my own custom fields, which take a "tag" attribute that allows them to update the server when they are changed.  Thus I have
<my:FredsTextInput tag="A0500C"/>  and I would really like to bind to the data WITHOUT repeating text="{Root.A0500C}" for each element.  I've got about 500 elements.  I have tried all the different definitions I can think of for FredsTextInput with no success.  Does Anyone have a solution?  If it matters, I'm using Flex 4 and here is my latest failure, which just shows  "{Globals.AssessmentData.A1300B}" in the TextInput field.
<mx:TextInput xmlns:fx="http://ns.adobe.com/mxml/2009"
              xmlns:s="library://ns.adobe.com/flex/spark"
              xmlns:mx="library://ns.adobe.com/flex/mx"
              xmlns:com="components.*"
             change="{AssessmentService.saveChanges(id,event.target.selectedItem.value)}"      >
<mx:Script>
    <![CDATA[
        [Bindable] private var _tag:String = "undefined"
        public function set tag(name:String):void {
            //Globals.log("setting tag on checkbox "+name);
            _tag=name;
            var longname = "{Globals.AssessmentData."+name+"}";
            super.text = "{Globals.AssessmentData.A1300B}";
            toolTip = name +"="+ super.text;           
    ]]>
</mx:Script>
</mx:TextInput>

Create your bindings with an ActionScript loop?

Similar Messages

  • Dynamic binding expression to get data from array

    I am retrieveing from an object to label my button as
    follows:
    quote:
    <mx:Button label = "{wordlist.word.LABEL[0][index]}"
    I now want the binding expression to be dynamic, meaning that
    LABEL has to be a variable. How would I do this?
    quote:
    <mx:Button label =
    "{wordlist.word.????[LABEL]????[0][index]}"

    "lunacafu" <[email protected]> wrote in
    message
    news:gqte13$1g4$[email protected]..
    >I am retrieveing from an object to label my button as
    follows:
    >
    >
    quote:
    <mx:Button label = "{wordlist.word.LABEL[0][index]}"
    >
    > I now want the binding expression to be dynamic, meaning
    that LABEL has to
    > be
    > a variable. How would I do this?
    >
    >
    quote:
    <mx:Button label =
    "{wordlist.word.????[LABEL]????[0][index]}"
    First, if wordlist.word.LABEL is an XMLListCollection or
    ArrayCollection,
    you need to use getItemAt instead of bracket notation. Once
    you get to that
    point, you need to cast it to whatever data type the object
    at 0 is.
    HTH;
    Amy

  • Use field value in xml binding expression

    Hi all.
    I'm trying to access dropdownlist selected value from a binding expression.
    I have a dropdownlist called rooms which is bound to some XML data. When the selection changes I woud like to access that value in another dropdownlist called members which is also bound to some XML data.
    The expression I tried is:
    $record.room.[roomname==$form.company.mainform.rooms.rawValue].member[*]
    I'm calling this code on the rooms.changed event (alsop tried on rooms.exit event):
         members.execCalculate();
    Aparently $form.company.mainform.rooms.rawValue doesn't return the selected value of the rooms dropdownlist.
    Is there a way to get the selected event from a different form and re-calculate binding of the field?
    thanx

    Binding is not dynamic ...meaning that it is set when the form is rendered and cannot be changed on the fly.
    Paul

  • Binding expressions and collections

    <quote>
    In addition to being able to read the initial value of a field from an object, value binding expressions can also be used to navigate maps, lists, or arrays. Here are some examples:
    #{foo[bar]}
    #{foo["bar"]}
    #{foo[3]}
    #[foo[3].bar}
    #{foo.bar[3]}
    </quote>
    Could anyone explain how does it work ? Is foo is always bean ?
    Isn't #{foo["bar"]} identical to #{foo.bar}
    Also in "Core JSF" they say #{foo.bar[3]} doesn't work if bar indexed property of a bean.
    <anotherquote>
    The syntax of a method binding expression has two primary formats:
    #{expr-a.value-b}
    #{expr-a[value-b]}
    The first format is a classic DOM-style object tree structure. The second format can be used to call a method pointed to from an object array, Map, or List.
    </anotherquote>
    The same question how to use the second form.

    An expression is a little piece of softwaremuch like a scriptthat evaluates to a single value for a single layer property at a specific point in time. Whereas scripts tell an application to _do_ something, an expression says that a property _is_ something.
    With expressions, you can create relationships between layer properties and use the keyframes of one property to dynamically animate other layers. For example, you can use the pick whip to link path properties, so a mask can take its path from a brush stroke or a shape layer object.
    The expression language is based on the standard JavaScript language, but you do not need to know JavaScript to use expressions. You can create expressions by using the pick whip or by copying simple examples and modifying them to suit your needs.
    Be sure to read the
    "Expressions" section of After Effects Help on the Web.
    Dan Ebberts has an excellent collection of example expressions and scripts and tutorials for learning how to work with expressions and scripts on his website: http://www.adobe.com/go/learn_ae_motionscripthome.
    The AE Enhancers forum provides many examples and much information about expressions, as well as scripts and animation presets: http://www.adobe.com/go/learn_ae_aeenhancershome.
    JJ Gifford provides several example projects on his website that demonstrate how to use expressions: http://www.adobe.com/go/learn_ae_jjgiffordexpressions.

  • Dynamically change the Binding of a view object

    I want to reuse a panel several times in my application. The VO has one bind parameter (:1). The same panel should be reused several times with different bind variables.
    I found a technical note concerning this issue called: How to Dynamically Change the binding of a View Object to a JClient Panel. This works for JDeveloper 9i but not for JDeveloper 19g. Does anybody know how to dynamically change the binding in JDeveloper 10g

    You may use bindRowSetIterator() and pass in a custom fetched ViewObject or a RowSetIterator to the iterator binding that is displayed in your panel.

  • Faces config exception - Can't get value from value binding expression:

    the menuItem_Department shown property takes value from userRight's session bean object userDetail.
    class UserRights{
        public boolean mDept = false;
        public boolean loggedIn = false;
        public boolean admin = false;
       //accessors
    }now, the shown property picks correct value for #{userDetail.admin} but gives erros on this. any idea how to get around this exception:
    Managedbean menuItem_Department could not be created Can't get value from value binding expression: '#{userDetail.mDept}'.
    javax.faces.FacesException: Can't get value from value binding expression: '#{userDetail.mDept}'     at com.sun.faces.config.ManagedBeanFactory.evaluateValueBindingGet(ManagedBeanFactory.java:903)
         at com.sun.faces.config.ManagedBeanFactory.setPropertiesIntoBean(ManagedBeanFactory.java:547)
         at com.sun.faces.config.ManagedBeanFactory.newInstance(ManagedBeanFactory.java:233)
         at com.sun.faces.application.ApplicationAssociate.createAndMaybeStoreManagedBeans(ApplicationAssociate.java:256)
    .. stack tracepointers appreciated.
    reagrds
    Rabs

    well, i figured out the problem so thought to share with all aswell.
    all i changed was the name of the variable from mDept to dept.
    java beans has its own set of rules and naming conventions which i have not read much about but this problem had to do sumthing with that!
    just changing the name simply works fine!

  • Using value binding expressions to set 'required' attribute

    I am trying to use a value binding expression to determine whether the value of various input control's is required or not according to where they are used and not having much luck. I wonder if anyone can shed some light on this...
    The following expression works: <h:inputText id="name" required="#{true}"/> whereas <c:set var="required" value="true" scope="request"/>
    <h:inputText id="name" required="#{required}"/> does not, even though the expression evaluates to true! I have tried numerous variations (requestScope.required, required == true, required ? true : false, etc.) to no avail. Interestingly, #{1 == 1} or binding to a backing bean method works, but as soon as you add a request variable it breaks.
    Am I doing something wrong, is this something that JSF doesn't allow, or just a bug in the RI? Note that I don't want to vary this flag between multiple submissions of the same form, I am just trying to reuse the same JSP include to generate form controls for required and optional data on different forms to avoid a whole lot of cutting any pasting.
    Any pointers gratefully received.
    -- Keith Wilson

    I had something like this happen, and here's what I concluded the problem was. Perhaps your problem is similar.
    In the first non-working example you show a request-scope variable being set in the JSP page, and then use that to set the "required" attribute. But consider what happens when you submit the form. There is no longer any request-scope variable set because we have a new request and we don't go through the JSP page! (Not before validation is checked, anyhow).
    So basically I concluded that the variable had to be in (say) session scope for it to work as you would like.

  • Using value binding expression for to-view-id

    hi;
    is it possible to use a value binding expression in the <to-view-id> element?
    if not, is there a logical reason for this?
    thanks

    Shrek-2:
    Are we there yet?No
    Are we there yet?No
    Are we there yet?Yes
    Really?
    NO
    Seriously, the default navigation handler does not allow to use EL for the to-view-id, but you can obtain the desire behaviour with the custom handler decorator.
    This is a code snippet:
         public void handleNavigation(FacesContext fc, String actionMethod, String actionName) {
              _base.handleNavigation(fc, actionMethod, actionName);
              String viewId = fc.getViewRoot().getViewId();
            if ((viewId.indexOf("#{") != -1) &&
                    (viewId.indexOf("#{") < viewId.indexOf('}'))) {
                 String bviewId = (String)fc.getApplication().createValueBinding(viewId).getValue(fc);
                 if (bviewId != null)
                      fc.getViewRoot().setViewId(bviewId);
                 else {
                      // you can throw the exception here
         }More about HandlerDecorator:
    http://www.jsftutorials.net/jsfNavigation/jsf-login-navigation-redirect.html
    http://www.jsftutorials.net/faces-config/navigationDecorator.html
    P.S. Note: This feature might broke the separation between the different levels of application from the architectural point of view. Hard-coding the ViewIds inside the java code is not a good idea at all.
    Sergey : jsfTutorials.net

  • Function in binding expression

    Hi,
    I have a binding expression on a command link in adf faces as follows:
    <af:commandLink text="#{fn:substring(row.TransactionNo,1,2) =='0013' ? 'Receipt Details' : ''}"
    binding="#{backing_MaintainAccounts3.commandLink1}"
    id="commandLink1" action="Edit">
    I just can't seem to get the right syntax for the substring?
    Are there any paticular tag libraries I would need in my JSF?
    Thanks for any help,
    Richard

    Hi,
    you are mixing xQuery strings with EL in JSF. I don't think this is going to work because ExpressionLanguage in JSF cannot have arguments.
    Frank

  • Localized String with params - Value Binding Expression...

    Hi All:
    I see many e.g.s where a command button / or a label's value can be a localized resource string using the generic value binding expression:
    "#{bundleVarName.keyName}"
    what if the resource string has parameters? for e.g.
    button.caption = Click Me for {0}
    Can we assign a value binding expression with params for button captions etc.
    Please help - I am a newbie in JSF,,,
    regards
    -Somesh

    JSF developers have forgotten about this :)
    Use other tools for displaying such messages (f. e. JSTL) where you need to have parametrized messaged.
    But mostly, non-parameterized JSF will be enough.

  • [svn:fx-trunk] 9349: * Added support for using getStyle() in Mxml data binding expressions.

    Revision: 9349
    Author:   [email protected]
    Date:     2009-08-17 11:32:37 -0700 (Mon, 17 Aug 2009)
    Log Message:
    Added support for using getStyle() in Mxml data binding expressions.
      In addition to the existing "function return watcher" data binding
      functionality, we register to listen for style related change events
      when we see a function marked with [Bindable(style="true")].
      UIComponent's and TextGraphicElement's styleChanged() will now
      dispatch events for "getStyle()" FunctionReturnWatchers to handle.
      When null or "styleName" is passed into styleChanged(), we dispatch
      an "allStylesChanged" event.
    QE notes: mxunit test to follow
    Doc notes:
    Bugs: SDK-20394
    Reviewer: Glenn, Pete F, Peter D
    Tests run: checkintests, mxunit databinding
    Is noteworthy for integration: only if you want to start using it.
    Code-level description of changes:
      modules/compiler/src/java/flex2/compiler/as3/binding/DataBindingExtension.java
        Modified generateWatcher() to do the AST equivalent of the
        WatcherSetupUtil.vm change.
      modules/compiler/src/java/flex2/compiler/as3/binding/FunctionReturnWatcher.java
        Removed unused isNew variable and added isStyleWatcher variable.
        Modified shouldWriteSelf() to return true if isStyleWatcher is true.
      modules/compiler/src/java/flex2/compiler/as3/binding/WatcherSetupUtil.vm
        Modified writeFunctionReturnWatcher macro to add a true arg to the
        FunctionReturnWatcher constructor call when isStyleWatcher() is
        true.
      modules/compiler/src/java/flex2/compiler/as3/binding/BindableFirstPassEvaluator.java
        Modified evaluate(Context, MetaDataNode) to skip reporting an
        error for no events when style is true.
      modules/compiler/src/java/flex2/compiler/as3/binding/DataBindingFirstPassEvaluator.java
        Replaced insideCallExpression boolean with callExpressionStack
        Stack.  The "!insideCallExpression" checks were replaced with
        callExpressionStack.isEmpty().
        Modified addBindables() to handle [Bindable(style="true")].
        Made argumentListStack and resetSet more strongly typed.
      frameworks/projects/framework/src/mx/core/UIComponent.as
        Modified styleChanged() to dispatch a "Changed" and "allStylesChanged" from the previous
        parent and add listeners to the new parent when isStyle is true.
        Modified eventHandler to notifyListeners() when isStyle is true.
      frameworks/projects/spark/src/spark/primitives/supportClasses/TextGraphicElement.as
        Similar changes to UIComponent.
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-20394
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/framework/src/mx/binding/FunctionReturnWatcher.as
        flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UIComponent.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/primitives/supportClasses/TextGraphicE lement.as
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/as3/binding/BindableFirstPassEval uator.java
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/as3/binding/DataBindingExtension. java
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/as3/binding/DataBindingFirstPassE valuator.java
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/as3/binding/FunctionReturnWatcher .java
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/as3/binding/WatcherSetupUtil.vm

  • Dynamically changing form binding

    Hi,
    I would like to dynamically change the binding variable (bind.ref) of a subform during runtime based on a "change event" triggered by a single/multiple selection in a list box, contained in a different subform.
    List box A is part of subform A, during completion of the form, the user selects one or more entries from list box A and triggers a "change event". Based on this event a table, part of subform B, is filled with entries that depend on the users selection in the list box. The rows in this table are determined by the "bind.ref" value of subform B. That means, dependent on the list box selection "bind.ref" will be assigned with a different array, that is also constructed at runtime.
    Before asking for hints to a possible solution, I would like to know whether it is possible in general to change the binding of a subform dynamically (so not in the "initialize event" as in Daniel's case), based on a "change event" triggered by a list box selection?
    Regards,
    Franz

    Hi radzmar,
    Thanks for the reply, much appreciated.
    I also found out more on that topic under another adobe forum post:
    http://forums.adobe.com/message/3607404#3607404
    So, yes it seems the binding of for instance a list box can't be modified once it's set.
    I finally solved my issue by making subforms 'hidden' or 'visible' dependent on the items selected in a list box. This worked reasonably well.
    Cheers,
    Franz

  • Exception handling within a value-binding expression

    Hi all,
    Forgive me if this question seems odd, but I am a long-time Struts developer, new to JSF.
    In Struts, exception handling was easy because all requests were funnelled through some subclass of Action. Exception handling could effectively be consolidated into one spot by applying the template-method pattern.
    Of course, with JSF, this is not possible because method names in value-binding and action-binding expressions can be chosen arbitrarily. For this reason, I am exploring aspect-oriented (and other) techniques for consolidation JSF exception handling into one spot, but rather than focus too intently on that, it's clear that I first need the ability to forward to an error page when an exception is encountered in a value-binding or action-binding expression.
    For action-binding expressions, ExternalContext.dispatch("<view id>"); seems to work quite well, but I am unable to make the same work when in the context of a value-binding expression. This is probably attributed to the fact that at that point, I am in an entirely different phase of the JSF request processing lifecycle.
    What I'm looking to know is if anyone has a reliable means of forwarding to an error page within the context of a value-binding expression. Better yet, does anyone know a reliable way of forwarding to another view regardless of what phase you are in?
    If it makes a difference (and I think it does) the error page uses JSF as well, and uses the same layout (provided via custom tags courtesy of JSP 2.0 tag files), so some view components would have the same name as the page which encountered the error. This seems to get in the way of me simply defining the error page for a 500 in my web deployment descriptor.
    Thanks in advance to anyone with a working suggestion.
    -Kent

    Let me pose a purely hypothetical use case to demonstrate the problem:
    Imagine a page in an HR app, employeeDetails.jsp, that displays an always-up-to-date combo box which lists employee names and IDs. onChange triggers a form submit with the intention of simply posting back to this page, with various text boxes, etc. below updated to show all information for the selected employee.
    Obviously, with the requirement that the combo box always be up to date, it's clear that the getter invoked by the value-binding expression must access the database (not directly of course, but via a facade, application, then data-access layer). Any unexpected and unchecked exception in this chain would propagate back up to the getter method on the backing bean. I need to, at that point, log the exception (trivial) and forward to a user-friendly error page.
    I suppose I could put some contraint on myself that data access is only performed within ActionEvent handlers, but I'm not sure that's consistent with the JSF model in general, in fact it almost seems Struts-like in that I'd have to invoke some action before loading this form to build the up-to-date list for the combo box, shove it in request scope, where it's then available to the page indicated by the navigation rules. Submission of the form on the page in question would also need to result in rebuilding the up-to-date list. Now we're looking at firther propagation of code. I want to avoid this, so I am looking for a better way.

  • Dynamically change the binding of a field

    Hi,
    I've been looking all over the internet for 2 days to find the answer to my question, but I couldn't get any information on my problem. Here's what i'm trying to do :
    Based on a checkbox in my form, I want to export or I don't want to export a field to a XML document.
    My checkbox is working properly and I got the Send button with the XML working too. I only need to find a way to dynamically change the binding property of my field. I've read some informations with the ".bind.match", but I can't seem to make it work.
    I'm using Windows XP, LiveCycle Designer ES2 v.9.0 and I have to run the form in Reader 8.0.
    Thanks alot for your help, it's greatly appreciated.
    Jonathan

    Hi,
    the binding cannot be changed at runtime.
    You can use the checkbox to delete the value of the field so the exported xml contains an empty tag.
    Or you try to delete the data node of the desired field in the data DOM (xfa.datasets).

  • Conditionals in bind expression

    Is it possible to put a conditional in a bind expression?
    For example:
    <cfinput type="text" name="searchParam" id="searchParam">
    <cfdiv id="searchResult" bindonload="no" bind="url:sr.cfm?search_param={searchParam@blur}"></cfdiv>
    In this example, sr.cfm will be loaded in the cfdiv EVERY TIME that focus is blurred from the input field.
    Is it possible to set it so that the cfdiv will NOT load sr.cfm IF the input field is blank??  Something like:
    bind="url:sr.cfm?search_param={searchParam<cfif searchParam neq ''>@blur</cfif>}"
    Is this possible?  Or is there something like it that will work?
    Thanks,
    ^_^

    Another site helped me figure it out.
    <cfajaxproxy bind="javascript:searchOnBlur({search_text@blur},{search_type@blur},'search_text','comp') ">
    <script type="text/javascript">
    searchOnBlur = function(a,z,b,c) {
        sf = document.app_search[b];
        cc = document.app_search[c];
        st = "";
        for(i=0;i<document.app_search.search_type.length;i++) {
            document.app_search.search_type[i].checked ? st = document.app_search.search_type[i].value : null ;
        if(cc.value != sf.value) {
            cc.value = sf.value;
            ColdFusion.navigate("search_results.cfm?search_text="+sf.value+"&search_type="+st+"",'search_results',mycallBack,myerrorHandler);
    </script>
    <cfinput type="text" name="search_text" id="search_text">
    <cfinput type="hidden" name="comp" id="comp" value="">
    search_type=radio inputs (two of them); one for name, the other for number
    ^_^

Maybe you are looking for

  • Pdf file doesn't show

    On this page http://www.mensjevankeulen.nl/nieuws.htm is a link to a pdf file. Please go to the second text bloc and click on the bold words "artikel in de NRC". When I click on it, the pdf opens in a new browser page, but the client sees only a whit

  • Iphoto has reorganized my photos?

    My iPhoto has been organizing my photos where when I add new photos they are added to the bottom in order. After updating my software(i had to get a new hard drive, but everything was backed up) I went and added new photos to my iPhoto and now new ph

  • Automator to change appearance of keynote slides

    Hi I'm a newbie to Mac and would appreciate any assistance I've been using keynotes to make my study notes (one slide poses a question and the next slide answers the question), and I'm fed up having to manually change the appearance of my slides. I w

  • 3D capture from Revit 2010

    Does anyone have idea / any set up guide line to take 3D capture from Revit structure 2010? It works with Revit structure 2009 by turning on OpenGL option, but I don't know the set up in Revit structure 2010. Any direction would be appreciate. Thanks

  • 401 Unauthorized Message - when trying to access asmx-webservice from a SP 2013 Workflow

    Hello everybody! I made a workflow for sharepoint 2013, including the "call http web service"-action. Therein I am trying to access https://mysp.com/sites/mysite/_vti_bin/lists.asmx via GET Request. So nothing fancy one might think, but somehow it is