Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problem with edit box
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi,
I have a edit box.
when i enter 2 in the edit box and click add button.
its adding 2 edit boxes .
now i need to enter data in the 2 edit boxes
similarly if i enter 4, i need to enter data in the 4 edit boxes.
so it all depends on the number which i enter in the 1st edit box.
iam stuck up with the implementation.
As i need to write a code so that if even i enter 10 in the 1st edit and click add button, i should be able to enter the data in the 10 edit boxes which gets populated.
Any help will be really appreciated.
Regards;
Vijay
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi,
Check "name" property of the text boxes getting created at runtime. You can use descriptive porgramming to handle this situation.
Reply
#3
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi,

Follow the below steps & try to implement on your own:
Step1. Create a Description Object for Edit(ex: WebEdit/WinEdit).
Step2. After giving 'n' in Editbox & clicking Add button , Use ChildObjects method & retrieve the Editbox object collection & get the Editbox count.
Step3. Use For loop & Set the required input values into all the Editboxes one by one.

Refer 'Help' file for more info. on 'ChildObjects' method.Smile
Reply
#4
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi,
I am using the following code.
As there are so many edit boxes, i am filtering it.

Code:
Browser("micclass:=browser").page("micclass:=page").WebEdit("name:=sourceMoreRows").Set 1------>acts as switch
    var= Browser("micclass:=browser").page("micclass:=page").WebEdit("name:=sourceMoreRows").GetROProperty("value")
Browser("micclass:=browser").page("micclass:=page").WebButton("Name:=More Sources").Click

Set WbEdit = Description.Create()
WbEdit("micclass").Value = "WebEdit"
WbEdit("html id").Value = sourceName_0
Set AllWbEdit = Browser("micclass:=browser").Page("micclass:=Page").ChildObjects(WbEdit)
NumberOfEdits=AllWbButton.Count
msgbox(NumberOfEdits)
For( i = 0 ,i<=var,i++)
WBname = AllWbEdit(i).GetROProperty("html id")
msgbox(WBname)
If trim(WBname) = trim(sourceName_0) Then
    AllWbEdit(i).Set "Test"

End If
Next
But the problem is when it adds new edit boxes, the name of the edit box changes
1st edit box name:sourceName_0
2nd edit box name:sourceName_1
and so on...
if i trim by name, i am able to set the value in only 1 edit box.
i want to set different values in the different edit boxes which populate after clicking add button.
Any help would be really appreciated.
Regards;
vijay
Reply
#5
Solved: 11 Years, 3 Months, 3 Weeks ago
Pls check the link on Descriptive Programming

Its too good and then you can modify as per your requirements.
Reply
#6
Solved: 11 Years, 3 Months, 3 Weeks ago
Code:
Browser("micclass:=browser").page("micclass:=page").WebEdit("name:=sourceMoreRows").Set 1------>acts as switch
var= Browser("micclass:=browser").page("micclass:=page").WebEdit("name:=sourceMoreRows").GetROProperty("value")
Browser("micclass:=browser").page("micclass:=page").WebButton("Name:=More Sources").Click

Set WbEdit = Description.Create()
WbEdit("micclass").Value = "WebEdit"
WbEdit("html id").Value = sourceName_0
Set AllWbEdit = Browser("micclass:=browser").Page("micclass:=Page").ChildObjects(WbEdit)
NumberOfEdits=AllWbButton.Count
msgbox(NumberOfEdits)
For i=0 to var
WBname = AllWbEdit(i).GetROProperty("html id")
msgbox(WBname)
If trim(WBname) = trim(sourceName_0) Then
AllWbEdit(i).Set "Test"


when i run this particular code i am getting general run error at

Code:
WBname = AllWbEdit(i).GetROProperty("html id")

Any help will be really appreciated.
Regards;
vijay
Reply
#7
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi Vijay,

Try with the below code.

Code:
Set WbEdit = Description.Create()
WbEdit("micclass").Value = "WebEdit"
WbEdit("html id").Value = "sourceName.*"
Set AllWbEdit = Browser("micclass:=browser").Page("micclass:=Page").ChildObjects(WbEdit)
NumberOfEdits=AllWbEdit.Count
For i=0 to (NumberOfEdits-1)
    if AllWbEdit(i).GetRoproperty("html id")<>"sourceName_0" then
        AllWbEdit(i).Set "Test"
   End if
Next
Reply
#8
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi,
Thanks a lot, the above code works fine.
If at all i want to set different set of data.
what i mean is can i set test in the edit box 1 and test 2 in edit box 2.i want to set different sets of data.i want to use varying test data from the spread sheet.
using this code i can set only test in the edit boxes.
any help will be really appreciated.
Regards;
vijay
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to edit a text in aParagraph shaan.mishra87@gmail.com 2 2,547 08-26-2016, 04:48 PM
Last Post: shaan.mishra87@gmail.com
  Auto complete for Web Edit box branjitk 2 5,920 12-20-2014, 09:31 PM
Last Post: supputuri
  Could not able to click on 'Edit' Button in a Table kotaramamohana 3 3,620 09-26-2012, 07:40 PM
Last Post: krr
  Unable to select an item from weblist and unable to enter text in edit box estherindu 5 9,578 05-15-2012, 12:07 AM
Last Post: viswa
  Microsoftoutlook 2003 Email from QTP Script waring box problem Uma 5 5,360 11-30-2011, 02:05 PM
Last Post: tirru

Forum Jump:


Users browsing this thread: 1 Guest(s)