[jawsscripts] Re: The GetListOfFormFields function annd Delimiters

  • From: "Bryan Garaventa" <bgaraventa11@xxxxxxxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Tue, 15 Sep 2009 16:17:30 -0700

You could do something like the following to loop through all relevant 
password form fields...

var object dom, object array, object o, int i
let dom = IEGetCurrentDocument()
let array = dom.getElementsByTagName("input")
let i = 0
while(i < array.length)
let o = array(i)
if o.type == "password" then

; here is each instance of a password field within the o object.

endif
let i = i + 1
endWhile

----- Original Message ----- 
From: "Donald Marang" <donald.marang@xxxxxxxxx>
To: <jawsscripts@xxxxxxxxxxxxx>
Sent: Tuesday, September 15, 2009 2:58 PM
Subject: [jawsscripts] The GetListOfFormFields function annd Delimiters


>I have been attempting to determine the number of Edit fields on a web 
>page.  I have tried to pull that information from the DOM, but I am not 
>grasping how to create a collection of edit / password fields.  As a 
>backup, I attempted to use the GetListOfFormFields function.  I can use 
>this function and then pass the returned string to the
> DlgSelectItemInList  function without any problems.  The
> DlgSelectItemInList  function will display the list showing and separating 
> the segments properly.  However, the GetListOfFormFields function has a 
> delimeter as the first parameter, it does not use the delimeter specified! 
> Therefore, I can not use StringSegmentCount to determine how many segments 
> are in the list.  I wrote my own MyStringSegnentCount before I noticed 
> that the GetListOfFormFields is at fault instead and does not use the 
> delimiter as the documentation suggests.  Does anyone know how the
>
> DlgSelectItemInList  function determines how to split up the segments?  Is 
> there a error in my logic or use in the test example below?  Can anyone 
> suggest a robust method to obtain the number of edit / password fields 
> visible on a web page?
>
>
> Here is a test function demonstrating the improper use of delimiters 
> returned in the GetListOfFormFields:
> Script SegmentTest ()
>
> Var
>
> String sTestString,
>
> String sDelimiter,
>
> Int iSegments
>
> Let sDelimiter = "|"
>
> Let sTestString = "UserID/ email: Edit|password Edit| line 3 \tEdit"
>
> Let sTestString = GetListOfFormFields (sDelimiter , WT_EDIT)
>
> ; InputBox ("Enter new string: ", "Here is the full string!", sTestString)
>
> Let iSegments = StringSegmentCount (sTestString, sDelimiter)
>
> SayInteger (iSegments)
>
> EndScript
>
>
> Don Marang
>
>
> __________
> Visit and contribute to The JAWS Script Repository http://jawsscripts.com
>
> View the list's information and change your settings at
> //www.freelists.org/list/jawsscripts
> 

__________ 
Visit and contribute to The JAWS Script Repository http://jawsscripts.com

View the list's information and change your settings at 
//www.freelists.org/list/jawsscripts

Other related posts: