Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How to get value of a FormItem that is a checkbox

    Hi friends,

    I'm new here ! and I have a question:

    First a bit of information about the client version and browser im using:

    - SmartClient Version: v9.0_2013-07-03/LGPL Development Only (built 2013-07-03)
    - i'm using Firefox 31 on Ubuntu linux.


    I have an GUI which contains input elements, dropdown lists, checkboxes etc. this is an existing working GUI (developed by another developer that is not avaiilable anymore)

    What I basically am trying to do - is get the value (checked\un-checked) of a certain checbox in the form.

    I'm trying the following:

    Code:
    Boolean chk_state = form.getField("checkbox_name").getValue();
    I've also tried .getValueField and a couple of others.

    nothing works, I also get a null.


    form.getField("checkbox_name") returns a FormItem object which I'm not fimilar with.



    How do I get the state\value of a checkbox in a form ?


    Any help will be appreciated.
    Thanks!
    Last edited by dave83; 11 Aug 2014, 05:08.

    #2
    Hi dave83,

    try DynamicForm.getValue() and also think about moving to current v4.1p/v9.1p or at least current v4.0p/v9.0p.

    You are using the initial 4.0p version, which is not recommended (Quote: "Original release (07/03/2013). Please use latest patched versions above to avoid hitting already-fixed bugs.") and which will Isomorphic definitely tell you once you report a problem with the framework.

    Best regards,
    Blama

    Comment


      #3
      As additional note, as I don't know how you debug GWT (in general, not SmartGWT-specific). If you are using GWT superdev mode, it's fine. If you are not debugging the client side at all so far, think about moving back to (unsupported) Firefox 26 or still supported Firefox 24.7 ESR, each in combination with the Google Web Developer Plugin. FF27+ removed support for it.

      Best regards,
      Blama

      Comment


        #4
        Thanks

        Thanks blama ! I will try that.

        Comment


          #5
          Another question

          I suspect that at the position in the code where i'm trying to get the checkbox value, the form was populated with the GUI but I do not know if it also got populated with data.
          (the GUI is being built from a data source json file)

          Is there any method to tell if the form is populated with data or not ?

          Many thanks,
          Dave

          Comment


            #6
            You could ask for the PK-field value (see your ds.xml for that form's DataSource). If that returns null, the form either did not load data, yet, or there was no data for the specified PK. Make sure that the PK-field is part of the form (it may be hidden, though).
            If you want to be sure to act after loading, do your check in the CallBack of the form's fetchData().

            I also recommend to read the Quick Start Guide, it's a 1h read, but you'll get an insight in what's happening.

            Best regards,
            Blama
            Last edited by Blama; 11 Aug 2014, 07:25.

            Comment


              #7
              OK i'll do that, thanks for thr informative responses :)

              Dave

              Comment

              Working...
              X