Forum Discussion

sbkeenan's avatar
sbkeenan
Frequent Contributor
13 years ago

Changing the value of a Developer Express Date Picker control on a Web page

Hi



Has anyone successfully managed to change the value of a Developer Express date picker control on a web page?  I have such a control that I need to be able to test and whilst I can obtain the current date value from it, I am unable to change it.  The control currently allows a date to be keyed in directly, rather than using the dropdown to display a calendar.  I have the control mapped to a variable named dteCtrl, so I have tried





dteCtrl.Text = "08/28/2013"





I have also tried what methods I can find, as follows:





call dteCtrl.setText("08/28/2013")





and





call dteCtrl.setAttribute("Value", "08/28/2013")





In some instances, I can see that the control is updated with the specified value, but when I move off the control, it reverts back to its original value.



I have also tried recording a script to see how TestComplete completes the action, but it uses the same setText method that I have already tried, so when I run the recorded script, I can again see that the value is changed, but when I move off the control, it reverts back.



I would be very grateful for any assistance that anyone can offer.



Regards

Stephen.

2 Replies

  • googleid_105613's avatar
    googleid_105613
    Occasional Contributor
    Think about it the way a user does.  They click on the control and key in the data.  You can do the same thing by clicking on the control and call System.Keys("08/28/2013") to key in the data.  Your other option is to automate the drop down control, which could get messy.
  • sbkeenan's avatar
    sbkeenan
    Frequent Contributor
    Hi Will



    Thanks for the reply.  My final solution was to do just that, the only difference was that I used the Keys method with the assigned object variable.  So, I had 'dteCtrl' declared and assigned to the date picker object, then used the syntax Call dteCtrl.Keys("^a[Del]<new date>"), where <new date> is a date string in the form "mm/d/yyyy".



    I should really have posted this when I found that it worked, but I would still like to try and get the 'SetText' method to work, if possible.  I have logged a support call to see if the TestComplete Support team can shed any light on it!!



    Thanks again for your reply.



    Regards

    Stephen.