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
^_^

Similar Messages

  • 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!

  • 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

  • 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.

  • 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

  • [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

  • 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.

  • 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.

  • Evaluate binding expressions #{...} from Bean methods?

    Hello all,
    is it possible to evaluate the binding expressions that are usually given in the JSP page (e.g. #{someObject.someProperty} ) from a Bean method?
    I am currently searching for a more convenient way of accessing the resource bundle from a validator and could imagine an access over #{msg.someText}.

    Hello all,
    is it possible to evaluate the binding expressions that are usually given in the JSP page (e.g. #{someObject.someProperty} ) from a Bean method?
    I am currently searching for a more convenient way of accessing the resource bundle from a validator and could imagine an access over #{msg.someText}.

  • Need Few help about Binding expression

    I am new to jsf.I need to display a list of options in a single select option and want to collect the selected value .
    But during binding(on Netbeans 5.5) as i have seen it allows to bind to only single expression.
    so what can i do?
    is there a better method to to that ? pls suggest

    I don't understand you clearly. What exactly are you requirements? Having a h:selectOneListbox working, right? What exactly are your problems? You want to select multiple values, I understood? If so, then use h:selectManyListbox.

  • 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?

  • Get a binding value in a jsp variable

    Hello,
    I need to get the value of <c:out value="${bindings.PreviousSet.enabledString}" /> in a variable that I'm using in JSP.
    Do you know how can I do it?
    I need to do that because the image that I'm going to show in a page depends on that value.
    I have the following line
    <input type="image" src="images/wizard/anterior.gif" name="event_PreviousSet" value="PreviousSet" <c:out value="${bindings.PreviousSet.enabledString}" />/>
    if the value is enabled I'll show an image otherwise I'll show anotherone.
    Thanks

    In the case of the first question you can use the binding expressions directly in other JSTL expressions, not just c:out, for instance you can use a <c:if test="${bindings.PreviousSet.enabledString eq 'true'}>
    to conditionally print something in the page.
    The expression here refers to a "bindings" attribute on the request, so likewise if you want to get at the value in code you can use request.getAttribute("bindings") and work on down.
    Pauls question - you have to think slightly differently because everything is abstracted through the ADF model layer. A good place to start would be the ADF Primer:
    http://otn.oracle.com/products/jdev/collateral/papers/10g/ADFBindingPrimer/index.html
    Also check out:
    http://otn.oracle.com/products/jdev/tips/shmeltzer/setwhereclause/index.html

Maybe you are looking for

  • Screen does not turn on after start up, but after standby on Satellite M100

    Hi, I have quite some experience with computers and laptops, but this problem exhausted all my knowledge. My girlfriend has a Toshiba Satellite M100, PSMA1E. It runs Windows XP, currently on SP3. The laptop always had shutdown/stand bye issues. It wo

  • Problem by entering Persian\Arabic characters in String Control

    I'm working on a Jet Printer project. I must make an user interface using LabVIEW. This printer must print some Unicode characters on factory's products. Specialy Persian and Arabic characters. But it seems that there is not a string control with cap

  • Serial numbers in Goods issue

    Hi All, We have an existing Warehouse management process where the Goods issue is first posted. This creates a transfer order. The IDOC created by the transfer order tells the external system to Pick a material. Now we are trying to introduce serial

  • Multiple Context - Changing http server port

    Hi, Is it possible to change the firewall https port to different port? Normally in single context mode you can change it with this command. http server enable 4434 In multiple context mode there is no option for the port... http server enable ?

  • Solaris Installed but wont boot

    Compaq Deskpro 266 This is a straigt forward machine, no whacky install or hardware. 3 Gig HD Whole harddrive has been allocted for sun. The installation goes like a charm, I reboot the machine and pull the cd. It autoboots to the correct partition (