Compare Two Input value

Hi All,
I have two inputText box in JSF page one is for minValue and other is for maxValue. My problem is like this:
If i fill 20 in minValue box than maxValue should be >= to minValue. If not then an error message should be display on JSF page, after insertion of value in maxValue box.
Please suggest me, what options are avaiable in JSF to solve this kind of comparision. Please explain with example(s).

Likely you misunderstood the valueChangeListener / ValueChangeEvent.
To issue a ValueChangeEvent which will be used by valueChangeListener the client still have to submit the form to the server. Generally you see this back in selectboxes using the Javascript submit() function in the onchange attribute. Yes, that one is really a Javascript function. But this is only intented submit the form automatically on change of the value so that the client does not need to press the submit button. Finally, once the request is arrived into the server, the ValueChangeEvent will be created and fired. And that is certainly not clientside.
You may find this article interesting to get more insights in the JSF lifecycle:
http://balusc.xs4all.nl/srv/dev-jep-djl.html

Similar Messages

  • Compare two dropdownlists values with each other!!!!!!

    Hi ,
    I have two dropdown s with some values i want to compare two dropdowns values. I have java script on the click event of the button it will compare values of drodpowns. If any redundant/duplicate value found then those values need to be deleted from the second dropdown.
    function dummy()
    var dd1=xfa.resolveNode(form1.Page1.State.somExpression);       //path to first dropdown
    var dd2 = xfa.resolveNode(form1.Page1.Dummy.somExpression);  //path to second dropdown
    var i =0;
    var j=0;
    if(State.length!= 0)//State is first dropdown
         for (;i<dd1.length;i++)
              for(;j<dd2.length;j++)
                   if(dd1.getDisplayItem(i)==dd2.getDisplayItem(j))
                       dd2.deleteItem(j);   //deleting the value from second dropdown.
                        break;
                   else
                        continue;
    But this function is not working properly it is taking first value of the DD1 and comapring with all the values of DD2 and coming out of the loop .There are other values in the DD1.So for that comapring is not happening.
    Please help me !!!
    Thanks in advance,
    Bharathi.

    Hi,
    You just need to re-initialise the j variable each time though the i loop.  As you have it the second time around j will already be equal to dd2.length so will skip the inner loop.
    try
    for(var j=0;j<dd2.length;j++)
    Regards
    Bruce

  • Need ideas for alternative to JavaScript for comparing two inputText values

    Hello
    I am currently using the JavaScript method to check if the values of two inputText components are equal.
    If the values are not equal an alert box is displayed. In either case the action on the bean is performed and in the action method the two bean property values are compared again, if they don't match the action returns null and the for is redisplayed.
    I don't like this method because:
    A) it seems long winded and wasteful
    B) the JavaScript dialog box is out of character with the rest of the form, where validation errors are returned as messages next to the offending component.
    On one of the inputText components I already do a custom validation to check that the input value is a valid javax.mail.internet.InternetAddress.
    Does anyone know of any other method ideas, perhaps using Value Change Events that will allow a message to be written against the second inputText component if the two values did not match, and which could be done before the Invoke Application event. I have tried something along these lines but have failed.
    Many thanks in advance...

    If you can use a custom tag for the validator instead of the standard f:validator tag,
    there is a better way:
    The custom tag has an attribute , eg. "forId", to specify the ID of another component.
    Then, your validator can use the attribute for the parameter of findComponent().
    Something like:
    YourValidatorTagHandler.java
         protected Validator createValidator() throws JspException {
              YourValidator val = (YourValidator)super.createValidator();
              val.setForId(forId);
              return val;
    YourValidator.java
         public void setForId(String f) {
              forId = f;
         public void validate(
              FacesContext context,
              UIComponent component,
              Object value)
              throws ValidatorException {
                   int i1;
                   int i2;
                   try {
                        i1 = ((Integer) value).intValue();
                        UIComponent comp = component.findComponent(forId);
                        String val = (String)((UIInput)comp).getSubmittedValue();
                        i2 = Integer.parseInt(val);
                   } catch (RuntimeException e) {
                        FacesMessage msg = new FacesMessage(e.getMessage());
                        throw new ValidatorException(msg);
                   if (i1 != i2) {
                        FacesMessage msg = new FacesMessage("Error");
                        throw new ValidatorException(msg);
         }

  • Compare two input text in adf

    Hi
    i used the Build JDEVADF_11.1.1.4.0
    I want to make compare  validation between two  input text  Are equal or not . same Thing when i create new email i must enter the password and re enter password if not   equal  he give me message

    Hi,
    for a validation String, you can put autosubmit=true and in the valuechangeListener make the comparation.
    How to compare two Strings in java? http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java

  • How to compare two input fields

    Hi i have two input filds with labels E mail and confirmmail
    in both the input flds same value should be enter ,if data in second input field is different from first input field an error should be displayed,can u please expalin me with code
    thanks
    kishore

    Hi,
    use as follows
    String emailId1 = wdContext.currentContextElement().getID1();
           String emailId2 = wdContext.currentContextElement().getID2();
    //remove the following condition if not needed ,
           if( (emailId1 != null && !emailId1.trim().equals("")) && ( emailId2 != null && !emailId2.trim().equals("")))
                int x = emailId1.compareTo(emailId2);
                if( x == 0)
                     //Both are same
                else
                     //Do the else part
    Regards
    Ayyapparaj

  • Comparing two Date values in ActionScript - possible to compare whole day values?

    I need to be able to compare the number of whole days between two dates in ActionScript, is this possible?
    I'd like to test if one date is 7 days or less after today, and if so is it one day or less (if it's before today this also counts).
    The workaround I have in place is using the .time part of the date field:
    // Get the diffence between the current date and the due date
    var dateDiff:Date = new Date();
    dateDiff.setTime (dueDate.time - currentDate.time);
    if (dateDiff.time < ( 1 * 24 * 60 * 60 * 1000 ))
    return "Date is within 1 day");
    else if (dateDiff.time < ( 7 * 24 * 60 * 60 * 1000 ))
    return "Date is within 7 days");
    As I say - this is only a workaround, I'd like a permanent solution to allow me to check the number of whole days between 2 dates. Is this possible?
    Thanks

    I think this is the solution
    var daysDifference:Number = Math.floor((dueDate.time-currentDate.time)/(1000*60*60*24));
    if (daysDifference < 2)
    return new ClassFactory(DataGridRedRenderer);
    else if (daysDifference < 8)
    return new ClassFactory(DataGridOrangeRenderer);
    else
    return new ClassFactory(DefaultGridItemRenderer);

  • Comparing two column values with multiple Parameter in VC (Indicator)

    Hello VC experts,
    GM
    I would like to know about how to indicate multiple parameter with different colour in same column and also comparing value with adjucent column.
    Eg.
    Parameters     ,,           Column1      ,,              Column 2       ,,            Indicator (Image)
    Parameter 1    ,,             a1             ,,                     b1          ,,                  RED
    Parameter 2    ,,            a2              ,,                     b2          ,,                  GREEN
    Parameter 3    ,,            a3              ,,                     b3          ,,                 
    Parameter 4    ,,            a4              ,,                     b4          ,,
    In case I  : Parameter -1     Column 1 ( value)  =  more is better compared to Column 2
    In case II : Parameter -2     Column 1 ( value)  =  Less is better compared to Column 2
    How to acheive this  INDICATOR based value comparison.
    Edited by: Sunil  B. Mundhe on Mar 7, 2009 6:30 AM
    Edited by: Sunil  B. Mundhe on Mar 7, 2009 6:38 AM

    Hi
    This is possible in VC. You have to insert 'Image' UI in the required table. Add images of alert through 'Image manager' (Tools tab). Select relevant images of alert in 'Image' UI. In display there is option for 'visibility condition' there you enter condition (like if greater than ,true,false).
    Like wise you can add multiple 'Image' UIs in that table & based on visibility conditions you will get these alert images in table.
    Regards
    Sandeep

  • Comparing two List values using Oracle Business Rules

    Hi all,
    i just need to know how to use the Oracle Business Rules to Compare 2 list types
    say for example list1( 10,20,30,40) and List2(10,50,60). when i compare both the list using the business rules
    the rule should return true if there is atleast one match..here 10.
    any help is appreciated
    Thanks,
    karthik

    Hi folks,
    Please show the way....
    Regards,
    PavanKumar.M

  • Unable to enter Input value for an ICD

    Hi All,
    I have created an element XXX which has two input values "Pay Value" and "Class". The class has the values 'A','B','C','D'. I have created a plan and set up the rate In the calculation method I have chosen "No Standard values used".
    Now when I try to assign this ICD plan to the user in the Miscellaneous plan I am not able to enter the car class. Can someone help me with this.
    Thanks
    Shekar.

    Hi Shekar
    I find the ICD setup very 'picky'! If you get one thing wrong, it doesn't work. I have detailed below the steps I usually advise people to tek. Check your setup and see if this helps.
    1. Define Plan Type, Compensation Category = Others.
    2. Define Plan. Link to Plan Type. Plan Usage = May not be in program. On Not in program Tab - define sequence, currency, enrollment rate (per pay period?), activity reference period (Monthly). Your settings may need to be different. On Plan details tab, enter plan years.
    3. Plan enrollment requirements. On the general tab, plan sub tab, make sure the method = EXPLICIT. this allows the user to enter an input value for the ICD. THIS MAY WELL BE THE SOURCE OF YOUR PROBLEM!
    Make sure the CERTIFICATION region is UNTICKED. This can also cause ICDs not to work.
    ALLOWS UNRESTRICTED ENROLLMENT must be TICKED. Otherwise there is no eligibility to the ICD.
    On the rates subregion, make sure the run strt date is set to ENTERABLE.
    4. standard Rates form. Make sure the ACTIVITY TYPE and TAX TYPE are entered. Select the ELEMENT and the INPUT VALUE and TICK the ELEMENT AND INPUT VALUE REQUIRED field.
    On the processing Information tab - TICK ASSIGN ON ENROLMENT, DISPLAY ON ENROLLMENT and PROCESS EACH PAY PERIOD. Enter PER PAY PERIOD AMOUNT in VALUE PASSED TO PAYROLL and OTHER in COMPENSATION CATEGORY.
    Let me know if this works!
    Regards
    Tim

  • How to campare two date values ?

    Hi,
    I want to compare two string values which has date values.
    Here i post my sample code :
    import java.util.*;
    public class Now {
    public static void  main(String arg[]) {
    try{
        String pre_date="";
        Calendar cal = Calendar.getInstance(TimeZone.getDefault());
         String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
        java.text.SimpleDateFormat sdf =
        new java.text.SimpleDateFormat(DATE_FORMAT);
        sdf.setTimeZone(TimeZone.getDefault());
         String sdd= sdf.format(cal.getTime());
         String sysdat = sdd.substring(0,10);
         String pdate = "2007-02-08 18:11:44.0";
         pre_date = pdate.substring(0,10);
         System.out.println("sysdate is   "+sysdat);
         System.out.println("previous date is   "+pre_date);
         if ((pre_date==sysdat)) {
              System.out.println("hai ");
         else{
              System.out.println("welcome ");
        catch(Exception e){
              System.out.println("Error in file "+e.getMessage());
              e.printStackTrace();
    }Here the else part has been executed.
    But both values are same
    Please anybody helpe me how to compare these values in if condition
    Thanks
    MerlinRosina

    if ((pre_date==sysdat)) is wrong
    U need to use pre_date.equals(sysdat)

  • Problems comparing two Floats

    Hello all,
    I keep getting exceptions using the code for a table cell renderer listed below.
    Basically, the program blows up whenever the renderer is asked to compare two floats.
    Two string values, a string and a float, it does not have the desired effect, but a least it runs.
    "     public Object[][] aaTableValues = {
              { new Float( 700.00 ), new Float( 300.00 ), new Float( 400.00 ), "Fred", "Snead", "inform", "detail" },
              { new Float( 1000.00 ), new Float( 200.00 ), new Float( 800.00 ), "Jane", "Smith", "limit", "detail" },
              { new Float( 500.00 ), new Float( 200.00 ), new Float( 300.00 ), "Mary", "Ellis", "inform", "detail" },
              table1.setDefaultRenderer(Object.class, new DefaultTableCellRenderer() {
                public Component getTableCellRendererComponent(JTable table,
                                                        Object value,
                                                        boolean isSelected,
                                                        boolean hasFocus,
                                                        int row,
                                                        int column) {
                    super.getTableCellRendererComponent(table, value, isSelected,
                            hasFocus, row, column);
                    // Prepare default color        
                    Color color = isSelected ? table.getSelectionForeground(): table.getForeground();
                    if (column == 1) {
                        float val1 = 0.0F;
                            val1 = ((Float)value).floatValue();
                        float val2 = ((Float)table.getValueAt(row, column - 1)).floatValue();
                        if( val1 > val2) {
                            color = isSelected ? Color.red.brighter() : Color.red;
                    setForeground(color);
                    return this;
            });I get the runtime exceptions like the following:
    "Caught exception updating ExitableJFrame[frame0,0,0,618x430,invalid,layout=java.awt.BorderLayout,resizable,title=AccountActivityTable,defaultCloseOperation=,rootPane=javax.swing.JRootPane[,0,0,618x430,invalid,layout=javax.swing.JRootPane$RootLayout,alignmentX=null,alignmentY=null,border=,flags=2,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true,EXIT_ON_CLOSE]:
    java.lang.NullPointerException
         at FloatRenderer.getTableCellRendererComponent(Compiled Code)
         at javax.swing.JTable.prepareRenderer(JTable.java:2897)
         at javax.swing.plaf.basic.BasicTableUI.paintCell(BasicTableUI.java:968)
         at javax.swing.plaf.basic.BasicTableUI.paintRow(BasicTableUI.java:899)
         at javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:811)
         at javax.swing.plaf.ComponentUI.update(ComponentUI.java:43)
    Does anyone know how to fix this?

    If you look again at the error message, you'll see it's a NullPointerException. You are using a null reference. Nothing at all to do with comparing two float values. I'd guess that "table.getValueAt(row, column - 1)" is returning null, but it's hard to tell without a line number. You need to do some debugging in that code to see where you are using the null reference.

  • Is it possible to create a component that takes two inputs?

    Hi Experts,
    Is it possible to create a custom JSF component that takes two input values and assigns them to a managed bean?
    For example, a component that displays two input boxes?
    The tag would look something like this:
    <my:component value1="#{bean.value1}" value2="#{bean.value2}" />I've tried, but I can't get the values to update the managed bean.
    I'm starting to doubt that it is possible, as their is only 1 setSubmittedValue method :(
    Thank you,
    Ristretto

    Hi Prosun Bondopadhyay  ,
                   Component controller is the base of a wda component. its can be considered as the base class. all the other views can be considered as the sub classes of component  controller. so without the base class there is no existence for sub class rt?
    like we can use all the methods and attributes of a component controller(main class) across all the view(sub class) and the viceversa is not possible.
    hence we cannot create a wda without component controller.
    Regards
    Sarath

  • Catch Elements Where no Input Value Added

    Hello
    Before I begin can I just say I'm new to Oracle HRMS so if I say/state something stupid please bear with me!
    I have a non-recurring earnings element that has two input values, one to hold the pay value that is created via Fast Formula (very simply multiplies the Number of Units by a Unit Rate held as Global Variable) and a second that allows user to enter a number of Units, this value is passed into my formula. This part is all fine and works. Where I’m getting into trouble/can’t figure out is around the area of input validation.
    I’ve then created a second fast formula to validate input and then made a reference to the fast formula through the elements Input Values screen and returned result as error. Most of my validation in here is fine however I’m trying to figure out how do I figure out if the user hasn’t placed or has removed a value from element after its been attached?
    Let’s say I’ve attached my element to my assignment. I then go in and add 3 units. At this stage everything is fine and I save record. Then let’s say I go back in a remove the units entered and saved my record. Is there anyway I can get a message which says a null value has been entered? Is this something I do through a fast formula? I tried using isnull function but this doesn’t work. I’ve also tried defaulting my value in the fast formula and using was defaulted but again it doesn’t seem to work.
    Thanks for bearing with me! Any pointers/help would be gratefully received.

    Hello. My Element Input Validation Fast formula is
    Inputs are entry_value (text)
    IF ISNULL(entry_value) = 'Y' then
    (formula_Status = 'e'
    formula_message = 'Must enter something')
    If to_num(entry_value) < 1 or to_num(entry_value) >= 40
    then
    (formula_Status = 'e'
    formula_message = 'Night Duty overtime hours only claimable from 1 to 40 hours')
    ELSE
    (formula_Status = 's'
    formula_message = ' ')
    RETURN formula_Status,formula_message

  • Compare two text box values????

    Hello All,
    I do have one logic, but not sure where to write it so want your guys help for the same.
    The logic is:-
    if (&P13_NEW_PASSWORD. == &P13_CONFIRM_NEW_PASSWORD.) then
    insert into tbuser (password) values (&P13_NEW_PASSWORD.);
    else
    dbms_output.line_('Both the text boxes should be same!!')
    P13_NEW_PASSWORD and P13_CONFIRM_NEW_PASSWORD are two text boxes, where in above statment I'm comparing two text box values, if yes than insert that values into the DB tables otherwise displaying else messges.
    so can anybody tell me where should i write the above logic to make it work perfect..!!!
    thanks
    regards,
    Kumar

    Kumar,
    I'm glad you asked! Here's a great blog post on a custom auth scheme that hashes passwords:
    http://djmein.blogspot.com/2007/07/custom-authentication-authorisation.html
    I would suggest a few changes to the "get_hash" function. First, the DBMS_OBFUSCATION_TOOLKIT has been deprecated in favor of DBMS_CRYPTO:
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_crypto.htm
    http://www.psoug.org/reference/dbms_crypto.html
    DBMS_CRYPTO offers Message Authentication Code (MAC) functions which are keyed hashes. If you use a non-keyed function such as MD5 (which is VERY well known), someone can easily generate a table of all possible passwords within reason and their matching hash, which essentially allows them to get the passwords. MAC functions take in the data (password in this case) and a key. You can probably just use a big random string for your key. Now someone would need to the key as well to generate a hash table. In short, just use DBMS_CRYPTO.MAC where Duncan used DBMS_OBFUSCATION_TOOLKIT.md5.
    Tyler

  • How to map single input value to Two columns of Database table using format file of Bulk Copy Process

    Hi All,
    Am using OPENROWSET to load the file data into table, here the problem is i need to map same input value to two different columns of table, As format file doesn't allow the duplicate numbers am unable to insert same value to two columns, please help me to
    find a solution for this. 
    i can use only OPENROWSET because i need to insert some default values also which come based on file. only the problem is how to map same input value to two different columns of table. please give me the suggestions.
    Thanks,
    Sudhakar

    From what you say:
       INSERT tbl(col1, col2)
          SELECT col1, col1
          FROM   OPENROWSET(....)
    But I guess it is more difficult. You need to give more details. What sort of data source do you have? What does your query look like? The target table?
    Erland Sommarskog, SQL Server MVP, [email protected]
    Hi Erland,
    Thanks for your response
    my source file is text file with | symbol separate for ex:
    1002|eTab |V101|eTablet|V100|Logic|LT-7|Laptops|SCM
    Database table have columns like
    column1,column2,column3...etc, now i need to insert same value from input file into two columns for ex:
    the eTab value from text file has to be insert into column2 and column3 of
    table
    we cannot change format file like below one
    for the above situation how can we insert eTab into column2 and column3
    Thanks,
    Sudhakar.

Maybe you are looking for