Hi All,
Apologies for a simple question, but my plugins have always worked with drop down lists but I now move towards needing some text boxes. For the life of me I cannot work out how to get this to actually work.
So in my setup I have a dropdown box, which lets the user select the recipient then two textboxes, one for the title and one for the body, from what I can see it is gettign posted fine but then nothing happens after that, and on the events page the ActionFormatUI does not appear to be called.
I have tried a few variations, the text boxes with and without the sunique and UID and so on but seem to have no luck.
Has anyone had a similar issue, or has anyone got text boxes and dropdown boxes to work toghether and if so would you be able to share some code as an example or point me in the right direction.
I had a look at the sample plugins, but one is to complex for me to make sense of, and the other uses all drop down boxes which also does not help.
Any help is most appreciated,
Thanks!
Apologies for a simple question, but my plugins have always worked with drop down lists but I now move towards needing some text boxes. For the life of me I cannot work out how to get this to actually work.
So in my setup I have a dropdown box, which lets the user select the recipient then two textboxes, one for the title and one for the body, from what I can see it is gettign posted fine but then nothing happens after that, and on the events page the ActionFormatUI does not appear to be called.
I have tried a few variations, the text boxes with and without the sunique and UID and so on but seem to have no luck.
Has anyone had a similar issue, or has anyone got text boxes and dropdown boxes to work toghether and if so would you be able to share some code as an example or point me in the right direction.
I had a look at the sample plugins, but one is to complex for me to make sense of, and the other uses all drop down boxes which also does not help.
Any help is most appreciated,
Thanks!
Code:
Public Function ActionConfigured(ByVal ActInfo As IPlugInAPI.strTrigActInfo) As Boolean Dim Configured As Boolean = False Dim sKey As String Dim UID As String UID = ActInfo.UID.ToString If ActInfo.TANumber = 1 Then Dim itemsConfigured As Integer = 0 Dim itemsToConfigure As Integer = 3 If Not (ActInfo.DataIn Is Nothing) Then DeSerializeObject(ActInfo.DataIn, action) For Each sKey In action.Keys Select Case True Case InStr(sKey, "recipient_" & UID) > 0 AndAlso action(sKey) <> "" itemsConfigured += 1 Case InStr(sKey, "title_" & UID) > 0 AndAlso action(sKey) <> "" itemsConfigured += 1 Case InStr(sKey, "body_" & UID) > 0 AndAlso action(sKey) <> "" itemsConfigured += 1 End Select Next If itemsConfigured = itemsToConfigure Then Configured = True End If ElseIf ActInfo.TANumber = 2 Then ElseIf ActInfo.TANumber = 3 Then ElseIf ActInfo.TANumber = 4 Then End If Return Configured End Function Public Function ActionBuildUI(ByVal sUnique As String, ByVal ActInfo As HomeSeerAPI.IPlugInAPI.strTrigActInfo) As String Dim UID As String UID = ActInfo.UID.ToString Dim stb As New StringBuilder If ActInfo.TANumber = 1 Then Dim recipient As String = "" Dim title As String = "" Dim body As String = "" Dim dd As New clsJQuery.jqDropList("recipient_" & UID & sUnique, Pagename, True) Dim noteBody As New clsJQuery.jqTextBox("title_" & UID & sUnique, "text", "", "Events", 50, True) Dim noteTitle As New clsJQuery.jqTextBox("body_" & UID & sUnique, "text", "", "Events", 50, True) Dim sKey As String dd.autoPostBack = True dd.AddItem("--Please Select--", "", False) If Not (ActInfo.DataIn Is Nothing) Then DeSerializeObject(ActInfo.DataIn, action) Else 'new event, so clean out the action object action = New action End If For Each sKey In action.Keys Select Case True Case InStr(sKey, "recipient_" & UID) > 0 recipient = action(sKey) Case InStr(sKey, "title_" & UID) > 0 title = action(sKey) Case InStr(sKey, "body_" & UID) > 0 body = action(sKey) End Select Next dd.AddItem("All", "All", ("All" = recipient)) ..... For Each device In devices.Devices dd.AddItem(device.nickname, device.nickname, (device.nickname = recipient)) Next stb.Append("Recipient:") stb.Append(dd.Build) stb.Append(" ") stb.Append("Title" & noteTitle.Build) stb.Append(" ") stb.Append("Body:" & noteBody.Build) ElseIf ActInfo.TANumber = 2 Then ElseIf ActInfo.TANumber = 3 Then ElseIf ActInfo.TANumber = 4 Then End If Return stb.ToString End Function Public Function ActionProcessPostUI(ByVal PostData As Collections.Specialized.NameValueCollection, _ ByVal ActInfo As IPlugInAPI.strTrigActInfo) As IPlugInAPI.strMultiReturn Dim Ret As New HomeSeerAPI.IPlugInAPI.strMultiReturn Dim UID As String UID = ActInfo.UID.ToString Ret.sResult = "" ' We cannot be passed info ByRef from HomeSeer, so turn right around and return this same value so that if we want, ' we can exit here by returning 'Ret', all ready to go. If in this procedure we need to change DataOut or TrigInfo, ' we can still do that. Ret.DataOut = ActInfo.DataIn Ret.TrigActInfo = ActInfo If PostData Is Nothing Then Return Ret If PostData.Count < 1 Then Return Ret If Not (ActInfo.DataIn Is Nothing) Then DeSerializeObject(ActInfo.DataIn, action) End If Dim parts As Collections.Specialized.NameValueCollection Dim sKey As String parts = PostData Try For Each sKey In parts.Keys If sKey Is Nothing Then Continue For If String.IsNullOrEmpty(sKey.Trim) Then Continue For Select Case True Case InStr(sKey, "recipient_" & UID) > 0, InStr(sKey, "title_" & UID) > 0, InStr(sKey, "body_" & UID) > 0 action.Add(CObj(parts(sKey)), sKey) End Select Next If Not SerializeObject(action, Ret.DataOut) Then Ret.sResult = IFACE_NAME & " Error, Serialization failed. Signal Action not added." Return Ret End If Catch ex As Exception Ret.sResult = "ERROR, Exception in Action UI of " & IFACE_NAME & ": " & ex.Message Return Ret End Try ' All OK Ret.sResult = "" Return Ret End Function Public Function ActionFormatUI(ByVal ActInfo As IPlugInAPI.strTrigActInfo) As String Dim stb As New StringBuilder Dim sKey As String Dim UID As String UID = ActInfo.UID.ToString If ActInfo.TANumber = 1 Then Dim recipient As String = "" Dim title As String = "" Dim body As String = "" If Not (ActInfo.DataIn Is Nothing) Then DeSerializeObject(ActInfo.DataIn, action) End If For Each sKey In action.Keys Select Case True Case InStr(sKey, "recipient_" & UID) > 0 recipient = action(sKey) Case InStr(sKey, "title_" & UID) > 0 title = action(sKey) Case InStr(sKey, "body_" & UID) > 0 body = action(sKey) End Select Next stb.Append("The system send a push message to " & recipient) stb.Append("with the title " & title & " ") stb.Append("and body " & body) ElseIf ActInfo.TANumber = 2 Then ElseIf ActInfo.TANumber = 3 Then ElseIf ActInfo.TANumber = 4 Then End If Return stb.ToString End Function
Comment