Jump to content

Enable readonly or disabled text input field


Go to solution Solved by DavidC,

Recommended Posts

Posted (edited)
How do we enable a text input field that is readonly by default ?
 
Here is example code:
 
<form name="frm" action="result.asp" method="post">

<p>From:</p>
<input id="from" name="from" value="" readonly="readonly">
<img id="btn_from" alt="calendar" src="calendar.gif">
<script type="text/javascript">showCalendar('from', 'btn_from');</script>

<p>To:</p>
<input id="to" name="to" value="" readonly="readonly">
<img id="btn_to" alt="calendar" src="calendar.gif">
<script type="text/javascript">showCalendar('to', 'btn_to');</script>

<input type="submit" name="submit" value="Get results">

</form>
 
The 'from' and 'to' input fields are 'readonly'. An image of a calendar appears next to these fields onscreen. This image acts as a button which, when pressed, popups a calendar to allow a user to select a date. It is too difficult to select a date using the popup.
 
I need to input a date (string of text) into each readonly field (to be able to then submit the form). Is it possible?
 
Thanks in advance.

 

Edited by DavidC
Posted

If you run Internet Explorer use the IE UDF that comes with AutoIt and modify the readonly property of the input field.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

  • Solution
Posted (edited)

Thanks for your reply.

For the benefit of others, the 'ControlCommand' function works, ie:

$oIE = _IECreate("https://<url appears here>")
$oForm = _IEFormGetObjByName($oIE, "frm")

$from = _IEGetObjByName($oIE, "from")
$to = _IEGetObjByName($oIE, "to")

ControlCommand($oForm, '', '[NAME:from]', 'IsEnabled')
_IEFormElementSetValue($from, '29/05/2013')

ControlCommand($oForm, '', '[NAME:to]', 'IsEnabled')
_IEFormElementSetValue($to, '30/05/2013')
Edited by DavidC

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...