Topic
  • 5 replies
  • Latest Post - ‏2013-09-30T21:28:35Z by canutri
EGLcoder
EGLcoder
19 Posts

Pinned topic Using MVC in EGL RUI v8.5 and having difficultly with Update Button

‏2013-09-23T19:49:29Z |

I am using MVC in EGL RUI v8.5 WAS 6.1and I'm having difficulty with keeping my update button from becoming enabled even when I have errors in my fields.

I am using the handleValidStateChange function and disabling Update button when I have an error but when moving to a different field in the form it is enabling the Update button even though there is still errors in the form.

Can someone advise me on the proper technique needed to keep the button disabled until all errors are fixed?

 

  • XiaoBin/Jerry
    XiaoBin/Jerry
    14 Posts

    Re: Using MVC in EGL RUI v8.5 and having difficultly with Update Button

    ‏2013-09-24T09:18:28Z  

    Hi,

    Could you paste a short test code for the problem. I will see what the problem is. 

     

    Thanks

    -Xiaobin

  • EGLcoder
    EGLcoder
    19 Posts

    Re: Using MVC in EGL RUI v8.5 and having difficultly with Update Button

    ‏2013-09-24T13:02:07Z  

    Hi,

    Could you paste a short test code for the problem. I will see what the problem is. 

     

    Thanks

    -Xiaobin

    Here is the function:

     

    function handleValidStateChange_registrationData(view Widget in, valid boolean in)
            updateButton.disabled = false;

            for (n int from registrationData_form.entries.getSize() to 1 decrement by 1)

                  entry FormField = registrationData_form.entries[n];

                   if(entry.controller.view == view)
                         if(valid)
                                  // TODO: handle valid value
                         else
                                 msg String? = entry.controller.getErrorMessage();
                                 // TODO: handle invalid value
                                 updateButton.disabled = true;
                                 errorLabel.text = "Date Format is Invalid";
                         end
     
                   end
     
           end
    end
     

     

  • canutri
    canutri
    353 Posts

    Re: Using MVC in EGL RUI v8.5 and having difficultly with Update Button

    ‏2013-09-27T14:29:51Z  
    • EGLcoder
    • ‏2013-09-24T13:02:07Z

    Here is the function:

     

    function handleValidStateChange_registrationData(view Widget in, valid boolean in)
            updateButton.disabled = false;

            for (n int from registrationData_form.entries.getSize() to 1 decrement by 1)

                  entry FormField = registrationData_form.entries[n];

                   if(entry.controller.view == view)
                         if(valid)
                                  // TODO: handle valid value
                         else
                                 msg String? = entry.controller.getErrorMessage();
                                 // TODO: handle invalid value
                                 updateButton.disabled = true;
                                 errorLabel.text = "Date Format is Invalid";
                         end
     
                   end
     
           end
    end
     

     

    I am working with my colleague on this issue and we have found a solution to render an "Update" button as enable/disabled depending on the form's validity.  We created a global boolean array sized by the number for form fields in the form.  The boolean value is set accordingly in the if(valid) block of the handleValidStateChange_ function.  Our limited testing thus far indicates this will work.

    However, I was wondering if there was a property of the form itself to determine its current valid state without having to call the form's validation() function? It's observed in the documentation and our debuging that the form's isValid() and Validation() function call each form fields validation routines. 

    -Daron

  • XiaoBin/Jerry
    XiaoBin/Jerry
    14 Posts

    Re: Using MVC in EGL RUI v8.5 and having difficultly with Update Button

    ‏2013-09-29T05:19:02Z  
    • canutri
    • ‏2013-09-27T14:29:51Z

    I am working with my colleague on this issue and we have found a solution to render an "Update" button as enable/disabled depending on the form's validity.  We created a global boolean array sized by the number for form fields in the form.  The boolean value is set accordingly in the if(valid) block of the handleValidStateChange_ function.  Our limited testing thus far indicates this will work.

    However, I was wondering if there was a property of the form itself to determine its current valid state without having to call the form's validation() function? It's observed in the documentation and our debuging that the form's isValid() and Validation() function call each form fields validation routines. 

    -Daron

    Hi EGLcoder,

    I think Daron is right to do the enable/disable. But Daron will need to update the array's state every time controller do a validation. So you could use the isValid()  to check the form state. 

    For the isValid() will do the validation routines, I think the framework may need monitor every field's state. So Daron, you can open a RFE for this.

    Thank

    -Xiaobin

     

  • canutri
    canutri
    353 Posts

    Re: Using MVC in EGL RUI v8.5 and having difficultly with Update Button

    ‏2013-09-30T21:28:35Z  

    Hi EGLcoder,

    I think Daron is right to do the enable/disable. But Daron will need to update the array's state every time controller do a validation. So you could use the isValid()  to check the form state. 

    For the isValid() will do the validation routines, I think the framework may need monitor every field's state. So Daron, you can open a RFE for this.

    Thank

    -Xiaobin

     

    RFE has been added:
    http://www.ibm.com/developerworks/rfe/execute?use_case=viewRfe&CR_ID=39779

    -Daron