Forum Discussion

Philip_Baird's avatar
Philip_Baird
Community Expert
11 years ago

BuiltIn::InputQuery() does not set Value


Hi, I have the following function:


 


function testInputQuery() {


  var s = "abc";


  if( BuiltIn.InputQuery( "Test Complete", "Enter Value", s ) ) {


    Log.Message( s );


  }


}


 


When I run this function, no matter what value I enter in the dialog, when I click the "OK" button it ALWAYS logs "abc".


 


Given that the documentation states:


 


"Value


 


The variable whose value is displayed in the edit box when the window appears on screen for the first time. On return it contains the value entered by the user.


 


Since the method returns the entered value through the Value parameter, you should use a variable for this parameter."


 


my expectation is that the var s should be assigned whatever value I enter in the dialog.


 


I am using Test Complete 10 but have found this also fails in Test Complete 9.31.


 


Are my assumptions about how BuiltIn::InputQuery() should work correct?


 


Regards,


Phil Baird


  • Hi Phil,


     


    Let me quote the "InputQuery Method" article:


    Since JScript, C++Script and C#Script do not support the out parameters, the InputQuery function does not work in JScript, C++Script and C#Script projects. You can use InputBox as a workaround.


     


    As you are using JScript, the following should work for you:




      var s = "abc";


      Log.Message(BuiltIn.InputBox ("Test Complete", "Enter Value", s));




     

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Phil,


     


    Let me quote the "InputQuery Method" article:


    Since JScript, C++Script and C#Script do not support the out parameters, the InputQuery function does not work in JScript, C++Script and C#Script projects. You can use InputBox as a workaround.


     


    As you are using JScript, the following should work for you:




      var s = "abc";


      Log.Message(BuiltIn.InputBox ("Test Complete", "Enter Value", s));




     

  • Philip_Baird's avatar
    Philip_Baird
    Community Expert
    Doh, thanks Tanya, pays to read ALL the documentation!!!



    Regards,

    Phil Baird