Announcement

Collapse
No announcement yet.

Trying to Enable Controls using propertySet.Add

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Trying to Enable Controls using propertySet.Add

    I am trying to enable a jquery button from the postBackProc using propertySet.Add. Here is the control:
    Code:
    clsJQuery.jqButton jqbut = new clsJQuery.jqButton("btnenrollstat",  "Enroll Thermostat", this.PageName, false);
    jqbut.toolTip = "Enroll Thermostat and Create Thermostat Devices";
    jqbut.enabled = false;
    ...
    I have tried both of these calls in the postBackProc but neither have any effect:
    Code:
    if (isInputComplete()) this.propertySet.Add("btnenrollstat", "removeattr=disabled");
    if (isInputComplete()) this.propertySet.Add("btnenrollstat", "addattr=enabled");
    Any help would be appreciated.

    Kirby

  • #2
    i got the following from HST:

    Me.propertySet.Add("SETRESET_gLongitude" & clsJQuery.ID_IDENT, "removeattr=disabled")
    Note that you may have to add the “ID_IDENT” as we add that identifier to all control ID’s.
    hope this helps
    Mark

    HS3 Pro 3.0.0.435
    Hardware: Insteon Serial PLM | AD2USB for Vista Alarm | HAI Omnistat2 | 1-Wire HA7E | RFXrec433 | Dahua Cameras | LiftMaster Internet Gateway
    Plugins: Insteon (mine) | Vista Alarm (mine) | Omnistat 3 (by Kirby) | Ultra1Wire3 | RFXCOM | NetCAM | MyQ | BLRadar | BLDenon | Jon00 Charting
    Platform: HP h8-1360t, Windows Server 2012 R2, i7-3.4GHz, 16GB memory

    Comment


    • #3
      Thanks, Mark. This did help. The IDs in the html and the call now match. Here's the HTML:
      Code:
      <button type='submit'   id='btnEnrollStat_ID598385'  name='btnEnrollStat'  title
      ='Enroll Thermostat and Create Thermostat Devices'  disabled='disabled' >Enroll
      Thermostat</button>
      What threw me was this note in the documentation:
      Note that ID_IDENT is only appended if an ID is not explicitly set when a jquery control is created. If you DO specify an ID it is not appended.
      I also noticed that there is a disabled attribute in the html so it should work. I didn't though see any change in the page. Is there anything that needs to be done to get the page to update?

      Comment


      • #4
        i believe the .ID_IDENT is used in case there are multiple instances of a plugin running. this occurs in triggers and actions as well. assume HS appends something to your IDs. I usually check the source html generated in the browser to see what is actually created.
        Mark

        HS3 Pro 3.0.0.435
        Hardware: Insteon Serial PLM | AD2USB for Vista Alarm | HAI Omnistat2 | 1-Wire HA7E | RFXrec433 | Dahua Cameras | LiftMaster Internet Gateway
        Plugins: Insteon (mine) | Vista Alarm (mine) | Omnistat 3 (by Kirby) | Ultra1Wire3 | RFXCOM | NetCAM | MyQ | BLRadar | BLDenon | Jon00 Charting
        Platform: HP h8-1360t, Windows Server 2012 R2, i7-3.4GHz, 16GB memory

        Comment


        • #5
          Originally posted by Kirby View Post
          Thanks, Mark. This did help. The IDs in the html and the call now match. Here's the HTML:
          Code:
          <button type='submit'   id='btnEnrollStat_ID598385'  name='btnEnrollStat'  title
          ='Enroll Thermostat and Create Thermostat Devices'  disabled='disabled' >Enroll
          Thermostat</button>
          What threw me was this note in the documentation:

          I also noticed that there is a disabled attribute in the html so it should work. I didn't though see any change in the page. Is there anything that needs to be done to get the page to update?
          Did you ever get this to work? I have the same problem, everything is correct but the page does not change.

          Comment


          • #6
            This worked for me:
            This is in postBackProc:
            Code:
            if (isInputComplete()) this.propertySet.Add("btnEnrollStat" + clsJQuery.ID_IDENT, "removeattr=disabled");
            btrn EnrollStat is defined as:
            Code:
            clsJQuery.jqButton jqbut = new clsJQuery.jqButton("btnEnrollStat", "Enroll Thermostat", this.PageName, false);
                        jqbut.toolTip = "Enroll Thermostat and Create Thermostat Devices";
                        jqbut.enabled = enabled;
                        jqbut.functionToCallOnClick = "$.blockUI({ message: '<h2><img src=\"/images/" + hspi.IFACE_NAME + "/spinner.gif\" /> Creating Thermostat Devices...</h2>' });";
            
                        stb.Append(jqbut.Build() + "<br><br>");

            Comment


            • #7
              Originally posted by Kirby View Post
              This worked for me:
              This is in postBackProc:
              Code:
              if (isInputComplete()) this.propertySet.Add("btnEnrollStat" + clsJQuery.ID_IDENT, "removeattr=disabled");
              btrn EnrollStat is defined as:
              Code:
              clsJQuery.jqButton jqbut = new clsJQuery.jqButton("btnEnrollStat", "Enroll Thermostat", this.PageName, false);
                          jqbut.toolTip = "Enroll Thermostat and Create Thermostat Devices";
                          jqbut.enabled = enabled;
                          jqbut.functionToCallOnClick = "$.blockUI({ message: '<h2><img src=\"/images/" + hspi.IFACE_NAME + "/spinner.gif\" /> Creating Thermostat Devices...</h2>' });";
              
                          stb.Append(jqbut.Build() + "<br><br>");
              so simply adding
              this.propertySet.Add("btnEnrollStat" + clsJQuery.ID_IDENT, "addattr=disabled");

              should disable the button?
              not working for me.

              Comment

              Working...
              X