Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. why validation wont work?

why validation wont work?

Scheduled Pinned Locked Moved Java
helpquestion
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pancakeleh
    wrote on last edited by
    #1

    Hi, i have successfully added validation for my textboxes. i have 2 buttons, the add and the delete. When the user click on the add button without any input to the textboxes, a message will display telling the user to input value, however when the delete button is clicked instead of the add button, the validation would appear and it wont allow me to delete. why is this so? Needing help!

    modified on Tuesday, January 4, 2011 10:27 PM

    R T 2 Replies Last reply
    0
    • P pancakeleh

      Hi, i have successfully added validation for my textboxes. i have 2 buttons, the add and the delete. When the user click on the add button without any input to the textboxes, a message will display telling the user to input value, however when the delete button is clicked instead of the add button, the validation would appear and it wont allow me to delete. why is this so? Needing help!

      modified on Tuesday, January 4, 2011 10:27 PM

      R Offline
      R Offline
      RaviRanjanKr
      wrote on last edited by
      #2

      pancakeleh wrote:

      why is this so?

      it is very difficult to predict why it is so. please mention you code

      modified on Tuesday, January 4, 2011 11:16 PM

      P 1 Reply Last reply
      0
      • R RaviRanjanKr

        pancakeleh wrote:

        why is this so?

        it is very difficult to predict why it is so. please mention you code

        modified on Tuesday, January 4, 2011 11:16 PM

        P Offline
        P Offline
        pancakeleh
        wrote on last edited by
        #3

        my delete button code as follows:

        public String button1_action() {

          try{
              RowKey rk = tableRowGroup1.getRowKey();
        
              if(rk != null){
                  incidentdataDataProvider.removeRow(rk);
                  incidentdataDataProvider.commitChanges();
                  incidentdataDataProvider.refresh();
              }
        
          }catch(Exception ex){
                  log("ErrorDescription", ex);
                  error(ex.getMessage());
          }
            return null;
        }
        

        my add button as follows:

        public String add_btn_action(){

         String myString = (String) getIncidentidtxt().getValue();
         Integer incidentIDName = Integer.parseInt(myString);
         String incidentNameName = (String)getncidentnametxt().getValue();
        

        getSessionBean1().updateIncident(incidentIDName, incidentNameName);

        incidentdataDataProvider.refresh();
        
        
         return null;
        }
        
        1 Reply Last reply
        0
        • P pancakeleh

          Hi, i have successfully added validation for my textboxes. i have 2 buttons, the add and the delete. When the user click on the add button without any input to the textboxes, a message will display telling the user to input value, however when the delete button is clicked instead of the add button, the validation would appear and it wont allow me to delete. why is this so? Needing help!

          modified on Tuesday, January 4, 2011 10:27 PM

          T Offline
          T Offline
          TorstenH
          wrote on last edited by
          #4

          before starting validation, check which button was pressed. should be somewhere available in a Event-object or you extract that information to some variable, which you can access when and where needed. a boolean value should do the trick. regards Torsten

          I never finish anyth...

          P 1 Reply Last reply
          0
          • T TorstenH

            before starting validation, check which button was pressed. should be somewhere available in a Event-object or you extract that information to some variable, which you can access when and where needed. a boolean value should do the trick. regards Torsten

            I never finish anyth...

            P Offline
            P Offline
            pancakeleh
            wrote on last edited by
            #5

            thanks i manage to solve it ;)

            K 1 Reply Last reply
            0
            • P pancakeleh

              thanks i manage to solve it ;)

              K Offline
              K Offline
              Khalil Adam
              wrote on last edited by
              #6

              please pancakeleh, how did u do it?show as the code please...thanks alot..

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups