18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

Unable to set date value into a readonly textbox

Emihle2010Emihle2010 Members
edited August 2012 in Sahi - Open Source
Hi team,

I have a problem sahi can not find the ID of the textbox defined below.

<input name="ctrlPETimeline$ctrlTimelines$cgProjects$txtEnd_-1$txtDate" id="ctrlPETimeline_ctrlTimelines_cgProjects_txtEnd_-1_txtDate" style="text-align: left; width: 100%; background: none transparent scroll repeat 0% 0%;" onchange="CheckDateValue(this);SelectedEndDate(this);SelectedEndDate(this);" type="text" readOnly="readonly" ToolTip=""/>

This textbox has a small button next to it, when you click the button a calendar displays and when you select a date from the calendar, selected date get sets in the textbox.

when I set the value using sahi controller I get the "undefined" error. When I manually set the value it works but when i set i via sahi it doesn't. I have been stuck with this problem for the past 4 days and I am turning into circles.

_setValue("ctrlPETimeline_ctrlTimelines_cgProjects_txtStart_-1_txtDate", "22 Aug 2012");

Thank you for your hep. :-)

Comments

  • _setValue("ctrlPETimeline_ctrlTimelines_cgProjects_txtStart_-1_txtDate", "22 Aug 2012");?
    where is your element? shouldn't it be _setValue(_textbox("ctrlPETimeline_ctrlTimelines_cgProjects_txtStart_-1_txtDate"), "22 Aug 2012");
  • Hi globalworming,
    I meant to say _setValue(_textbox("ctrlPETimeline_ctrlTimelines_cgProjects_txtStart_-1_txtDate"), "22 Aug 2012"); this does not set the value to the textboox.

    Do you perhaps have an idea on how can I overcome this.

    thanks again
  • Well... if the textbox is filled via Javascript you could _call() the function filling the textbox, I think.
  • hi wormy,

    I tried this and it works like a charm :-)

    _assertFalse(_textbox("ctrlPETimeline_ctrlTimelines_cgProjects_txtStart_-1_txtDate").readOnly=false);

    _setValue(_textbox("ctrlPETimeline_ctrlTimelines_cgProjects_txtStart_-1_txtDate"), "22 Aug 2012");

    the value now gets set into the textbox and the value is committed when I click the save button.

    Thanks
  • Glad to help
  • Hi wormy,

    I have one more question, How would you check if a textbox or a button is disabled using he if statement?

    I want to achieve something like this:

    if(_getAttribute(_submit("btnRequestApproval")), "disabled"==true)
    {
    //do something
    }
    else
    {
    //do something else
    }
  • if(_condition(_submit("xyz").disabled)) _alert("true")
    else _alert(false)
    
  • That worked for me also. But in the same way i have to count the number of textboxes in a page. How should i do that
  • I tried the same as for checkbox but i am not getting any values

    //$textbox= _collect("_textbox", "/.*/", _in(_table(28)));
    //_debug($textbox);
    //_debug("Total No. of TextBoxes: "+ $textbox.length);
  • nagarnagar Members
    edited October 2012
    try using:
    _set($textbox, _count("_textbox","/.*/"));
    _alert($textbox);
  • I tried that but didnt worked.....
Sign In or Register to comment.