Announcement

Collapse
No announcement yet.

jqTextBox and autoPostBack

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

  • jqTextBox and autoPostBack

    Hi,

    I am building a plugin and I am trying to create an event action where I also need some text input. Based on the sample plugins, in ActionBuildUI I am able to create jqCheckbox and jqDropList fields, as I can set the autoPostBack=true on those fields. However, I can't seem to to set autoPostBack on a jqTextBox element.

    That means that ActionProcessPostUI will never be called for those text fields. It looks like I am missing something very obvious...

    Thanks for your help!
    stefxx

  • #2
    autoPostBack (or similar) is not required after all for jqTextBox; after a good diner things start working without any change from my end! Must have been some weird bit stuck somewhere

    Thanks anyway!
    stefxx

    Comment


    • #3
      I have the same issue. I just cannot make it work, no matter what I try.
      I added a jqButton to use as a save button, but that did not work either!

      If I add a jqDropList, and selecting something in it, then ActionProcessPostUI it triggered.

      I did have a look at the Email plugin html-code, and it seems that the save button is calling a script to make it work.

      I have the following code that does not call ActionProcessPostUI:

      Code:
                  clsJQuery.jqTextBox txtBox1 = new clsJQuery.jqTextBox("number_" + UID + sUnique, "phonenumber", "123456789", "sms", 80, false);
                  clsJQuery.jqTextBox txtBox2 = new clsJQuery.jqTextBox("message_" + UID + sUnique, "text", "", "sms", 80, false);            
                  clsJQuery.jqButton btn = new clsJQuery.jqButton("submit_" + UID + sUnique, "Save", "sms", true);
       
                  sb.Append("<table>");
                  sb.Append("<tr><td>Phone Number(s):</td><td>" + txtBox1.Build() + "</td></tr>");
                  sb.Append("<tr><td>Message:</td><td>" + txtBox2.Build() + "</td></tr>");
                  sb.Append("<tr><td></td><td>" + btn.Build() + "</td></tr>");
                  sb.Append("</table>");
                  
                  return sb.ToString();


      Have I missed something, or are there still bugs in HS3 for this area?
      After searcing the web, this forum and the SDK dokumentation, I have noticed that I am not the only one strugling with this.

      Comment


      • #4
        Originally posted by skaar View Post
        I have the same issue. I just cannot make it work, no matter what I try.
        I added a jqButton to use as a save button, but that did not work either!

        If I add a jqDropList, and selecting something in it, then ActionProcessPostUI it triggered.

        I did have a look at the Email plugin html-code, and it seems that the save button is calling a script to make it work.

        I have the following code that does not call ActionProcessPostUI:

        Code:
                    clsJQuery.jqTextBox txtBox1 = new clsJQuery.jqTextBox("number_" + UID + sUnique, "phonenumber", "123456789", "sms", 80, false);
                    clsJQuery.jqTextBox txtBox2 = new clsJQuery.jqTextBox("message_" + UID + sUnique, "text", "", "sms", 80, false);            
                    clsJQuery.jqButton btn = new clsJQuery.jqButton("submit_" + UID + sUnique, "Save", "sms", true);
         
                    sb.Append("<table>");
                    sb.Append("<tr><td>Phone Number(s):</td><td>" + txtBox1.Build() + "</td></tr>");
                    sb.Append("<tr><td>Message:</td><td>" + txtBox2.Build() + "</td></tr>");
                    sb.Append("<tr><td></td><td>" + btn.Build() + "</td></tr>");
                    sb.Append("</table>");
                    
                    return sb.ToString();


        Have I missed something, or are there still bugs in HS3 for this area?
        After searcing the web, this forum and the SDK dokumentation, I have noticed that I am not the only one strugling with this.

        I even tried the following, which according to the example in the SDK, should work:

        Code:
                    clsJQuery.jqTextBox txtBox1 = new clsJQuery.jqTextBox("number_" + UID + sUnique, "phonenumber", "12345678", "sms", 80, true);
                    txtBox1.toolTip = "Comma separated list of message receivers";
                    clsJQuery.jqButton btn = new clsJQuery.jqButton("submit_" + UID + sUnique, "Save", "sms", true);
        
                    sb.Append(Scheduler.PageBuilderAndMenu.clsPageBuilder.FormStart("myform2_" + UID + sUnique, "sms_" + UID + sUnique, "post"));
                    sb.Append(txtBox1.Build() + " " + btn.Build());
                    sb.Append(Scheduler.PageBuilderAndMenu.clsPageBuilder.FormEnd())

        ActionProcessPostUI is still not triggered in this case.
        Last edited by skaar; October 2nd, 2014, 06:49 AM.

        Comment


        • #5
          At the moment I have added an jqDropList, to make the plugin usable, but are hoping to remove it if possible.

          Any comments from HS3 developers?

          Comment


          • #6
            I am far from an expert with this and I struggled significantly understanding what was happening with this.

            One thing is that I do not think that you have to return a full form from ActionBuildUI, just a selection of HTML controls (help says "(String) HTML controls that need to be displayed so the user can select the action parameters"). In your example you are potentially encapsulating them with < form > < / form > tags which may not be helping. I just return them like this;

            Code:
             stb.Append("<br>To Device/Group:")
            stb.Append(mKey.Build)
            
            stb.Append("<br>Message Title:")
            stb.Append(mTitle.Build)
            
            stb.Append("<br>Message Body:")
            stb.Append(mMessage.Build)
            Return stb.ToString
            My Plugins:

            Pushover 3P | DoorBird 3P | Current Cost 3P | Velleman K8055 3P | LAMetric 3P | Garadget 3P | Hive 3P |
            Yeelight 3P | Nanoleaf 3P

            Comment


            • #7
              Originally posted by mrhappy View Post
              I am far from an expert with this and I struggled significantly understanding what was happening with this.

              One thing is that I do not think that you have to return a full form from ActionBuildUI, just a selection of HTML controls (help says "(String) HTML controls that need to be displayed so the user can select the action parameters"). In your example you are potentially encapsulating them with < form > < / form > tags which may not be helping. I just return them like this;

              Code:
               stb.Append("<br>To Device/Group:")
              stb.Append(mKey.Build)
              
              stb.Append("<br>Message Title:")
              stb.Append(mTitle.Build)
              
              stb.Append("<br>Message Body:")
              stb.Append(mMessage.Build)
              Return stb.ToString
              Thanks for the input. I'm afraid I have already tried your suggestion, creating the controls with as less code as possible:
              Code:
              sb.Append("Phone Number(s): " + txtBox1.Build() + "<br>");
              sb.Append("Message: " + txtBox2.Build() + "<br>");
              sb.Append("" + btn.Build() + "");
              Unless someone tells me otherwise, I'm pretty sure there is one or more bugs in HS3 causing the code above to be useless.

              Comment


              • #8
                I know I had problems with it and I don't know to be honest whether the sample plugin (I guess you are starting with this?) is that friendly and well explained. I know I added a load of debug statements to get to the bottom of it in the end. Can you share all of your ActionBuildUI?
                My Plugins:

                Pushover 3P | DoorBird 3P | Current Cost 3P | Velleman K8055 3P | LAMetric 3P | Garadget 3P | Hive 3P |
                Yeelight 3P | Nanoleaf 3P

                Comment


                • #9
                  Here is the full method:

                  Code:
                          public string ActionBuildUI(string sUnique, IPlugInAPI.strTrigActInfo ActInfo)
                          {
                              try
                              {
                                  string UID = ActInfo.UID.ToString();
                  
                                  Action action = new Action();
                                  if (!util.deserialize(ref ActInfo.DataIn, ref action))
                                  {
                                      action.Receivers = GlobalConf.defaultSmsReceiver;
                                  }
                  
                                  StringBuilder sb = new StringBuilder();
                  
                                  clsJQuery.jqDropList DL = new clsJQuery.jqDropList("Action1TypeList_" + UID + sUnique, "Events", true);
                                  DL.AddItem("(Select to save)", "0", true);
                                  DL.AddItem("Save", "1", false);
                                  DL.autoPostBack = true;
                  
                  
                                  clsJQuery.jqTextBox txtBox1 = new clsJQuery.jqTextBox("number_" + UID + sUnique, "phonenumber", action.Receivers, "sms", 80, true);
                                  txtBox1.toolTip = "Semicomma separated list of message receivers";
                                  clsJQuery.jqTextBox txtBox2 = new clsJQuery.jqTextBox("message_" + UID + sUnique, "text", action.Message, "sms", 80, true);
                                  clsJQuery.jqButton btn = new clsJQuery.jqButton("submit_" + UID + sUnique, "Save", "sms", true);
                  
                                  sb.Append("<table>");
                                  sb.Append("<tr><td>Phone Number(s):</td><td>" + txtBox1.Build() + "</td></tr>");
                                  sb.Append("<tr><td>Message:</td><td>" + txtBox2.Build() + "</td></tr>");
                                  sb.Append("<tr><td></td><td>" + btn.Build() + "</td></tr>");
                                  sb.Append("<tr><td></td><td>" + DL.Build() + "</td></tr>");
                                  sb.Append("</table>");
                  
                                  return sb.ToString();
                              }
                              catch (Exception ex)
                              {
                                  util.log(ex.ToString(), LogLevel.Error);
                                  return string.Empty;
                              }
                          }
                  Clicking "btn" does not post the content. If selecting "save" from "DL", then the content is posted as expected.

                  The entire plugin is now working as planned, except that i would like to have a button that posts the content instead of a dropdown list. I guess you cannot have everything you wish for

                  Comment

                  Working...
                  X