Trusted Contributor.. Monica Trusted Contributor..
Trusted Contributor..
351 views

How to create a multiple input field in the same tab

under requirement on clicking button it should ask for no of folders to be created from 1- 10 and based on this input i have to create a prompt box similar to the screenshot where we can enter the folder name (eg: if i say 2 so 2 textfeilds should be created similarly if i say 10 then 10 feilds should be created) based on texts entered in the field  foldes should be created .
Below code works but with multiple prompts (eg: if i say 2 in the range then 2 times the dialog box appears asking for folder name)

Kindly help me on how to create a single diialog box for the folder names 

If ActionName = "Folder_Range" Then
If User.IsInGroup("WellMed_Admin") Then
Dim irange
irange = InputBox("Select the no of Folders from range 1-10")
If irange = "" Then
Template_Requirements_ActionCanExecute = False
Exit Function
ElseIf irange > 10 Then
Msgbox "Not able to create folders"
Template_Requirements_ActionCanExecute = False
Exit Function
Else
Set OReq = TDConnection.ReqFactory.Item(Req_Fields.Field("RQ_REQ_ID").Value)
For i = 1 to irange
Set MyReq = TDConnection.ReqFactory.AddItem(Null)
MyReq.ParentId = Req_Fields.Field("RQ_REQ_ID").Value
On Error Resume Next
foldname = Inputbox("Enter folder name " & i)
If Len(foldname) <> 0 Then
MyReq.Name = foldname
MyReq.TypeId ="Folder"
MyReq.Post
MsgBox "Requirements folder have been created, successfully.Please click the Refresh button"
End if
Next
irange = Nothing
Template_Requirements_ActionCanExecute = False
Exit Function
End If
Else
MsgBox "This user role does not have permission to perform this action",48,"Operation Prevented"
Template_Requirements_ActionCanExecute = False
Exit Function
End If
End If
On Error GoTo 0
End Function


image.png

0 Likes
2 Replies
Knowledge Partner Knowledge Partner
Knowledge Partner

Re: How to create a multiple input field in the same tab

This is not possible in VBScript out of the box. You would need to either create your own DLL and make sure it is distributed to all users, or open a webpage that allows you to connect to ALM. Both these alternatives seem unnecessarily complicated.

So I think you should stick to your current solution.

Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
0 Likes
Highlighted
Trusted Contributor.. Monica Trusted Contributor..
Trusted Contributor..

Re: How to create a multiple input field in the same tab

I have created 2 IE browsers but it's behaving strange sometime the selected range is recognized and displays the range and sometimes it is not recognizing the range.

The First window is for selecting range in IE browser.Please find the code and screenshots below.

Function Template_Requirements_ActionCanExecute(ActionName)
On Error Resume NextIf ActionName = "Create_FolderSet" Then

On Error Resume Next
If User.IsInGroup("WellMed_Admin") Then
vari = CreateRequirementParameterUI
End If
End If

On Error Goto 0
End Function

 


Function CreateRequirementParameterUI

On Error Resume Next

Set objExplorer = CreateObject("InternetExplorer.Application")
set Reqfact = TDConnection.ReqFactory
set reqItem = Reqfact.Item(0)


objExplorer.Navigate "about:blank"
str = ""
str = str + "<HTML>"
str = str + " <BODY>"
str = str + " <HEAD>"
str = str + " <TITLE>Configure Parameters</TITLE>"
str = str + " </HEAD>"


str = str + " <br style=""background-color: White"">"
str = str + " <br style=""background-color: White"">"

str = str + " <table border = 0px style=""font-family :Arial; font-size:small; width: 100px "" id='TabConfigs'>"

str = str + " <br><br><tr>"
str = str + " <td width=""100px"" style=""text-align: left"">Select</td>"
str = str + " <td width=""75%"" style=""text-align: left"" id=""Configparam"">"

str = str + " <select name='paramname' id='paramname' style='width : 50px'>"
str = str + + "<option value=1 > 1 </option>"
str = str + + "<option value=2 > 2 </option>"
str = str + + "<option value=3 > 3 </option>"
str = str + + "<option value=4 > 4 </option>"
str = str + + "<option value=5 > 5 </option>"
str = str + + "<option value=6 > 6 </option>"
str = str + + "<option value=7 > 7 </option>"
str = str + + "<option value=8 > 8 </option>"
str = str + + "<option value=9 > 9 </option>"
str = str + + "<option value=10 > 10 </option>"
str = str + "</select>"
str = str + " </td></tr>"
str = str + " <tr> "
str = str + " <td colspan='2' align='right' height = 50px >"
str = str + " </td>"
str = str + " </tr>"
str = str + " <tr> "
str = str + " <td colspan='2' align='right'>"
str = str + " <input type='submit' value='OK' OnClick='VBScript&colon;OK.Value=1' ></input>"
str = str + " <INPUT TYPE='hidden' ID='OK' NAME='OK' VALUE='0' />"
str = str + " </td>"
str = str + " </tr>"
str = str + " </table> "
str = str + " </BODY>"
str = str + "</HTML>"

objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width = 150
objExplorer.Height = 250
objExplorer.Left = 50
objExplorer.Top = 50
objExplorer.Document.Body.InnerHTML = str
objExplorer.Document.Title = "Select Range"
objExplorer.Document.Body.Style.BackgroundColor = ""'"#D0DAE7"
objExplorer.Resizable=false
objExplorer.document.parentwindow.focus

With objExplorer.Document.ParentWindow.Screen

objExplorer.Left = (.availWidth - objExplorer.Width ) \ 2
objExplorer.Top = (.availHeight - objExplorer.Height) \ 2

End With


objExplorer.ExecWB OLECMDID_OPTICAL_ZOOM, OLECMDEXECOPT_DONTPROMPTUSER, CLng(intZoomLevel), vbNull
objExplorer.Visible = 1
seconds = 1
strCmd = "%COMSPEC% /C (PING -n " & ( seconds ) & " 127.0.0.1 >NUL 2>&1 || PING -n " & seconds & " ::1 >NUL 2>&1)"
Set WScript1 = CreateObject("WScript.Shell")
x = 0
Do While x = 0
' Wait till the OK button has been clicked
On Error Resume Next
Do While Trim(objExplorer.Document.All.OK.Value)=0

if Trim(objExplorer.Document.All.OK.Value) = 1 then
sValue = objExplorer.Document.getElementById("paramname").Value
x = 1
msgbox sValue
Exit Do
End if
Loop
On Error Goto 0
Loop
objExplorer.Quit
objExplorer= Nothing
End Function

1. Sometime on selecting the range in msgbox i am getting the selected value and sometimes though i have selected the value it is not recognizing it and ok button doesn't seem to work 

range.PNG

range.PNG

Tags (3)
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.