Jump to content
Sign in to follow this  
DavidC

Enable readonly or disabled text input field

Recommended Posts

DavidC
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

Share this post


Link to post
Share on other sites
water

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
DavidC

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

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.