PRODUCT |

|

|
|

|
|
|
|
|
FAQ |
|

|
|
|
|
|
|
LEARN SCRIPTING |
|

|
|
|
|
|
|
|
|
|
|
SAMPLE SCRIPTS |
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
HELP / DOCUMENTATION |
|

|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
Help Page - SS_ISFormField
( Some help pages may not display correctly in html because those help pages may have sample code in them, part of which may be mis-interpreted as html tags.
All help pages, including this help page, are available in biterScripting with the help command. )
|
|
Sample Script
SS_ISFormField
Purpose
Extracts name=value pair for a specified form field from the response from a web server.
Source Code
#####################################################################
# SCRIPT: SS_ISFormField.txt
#
# This script extracts name=value pair for a specified form field
# from the response from a web server.
#
# Input Arguments (FVA = Forward Variable Assignment)
#
# response - Server response. Pass the output from the previous response as the
# value of this argument.
# fieldname - name of the field.
#
# Form fields are returned by an internet server in the following format.
#
# type="field1_type" name="field1_name" id="field1_id" value="field1_value"
# type="field2_type" name="field2_name" id="field2_id" value="field2_value"
#
# The script will extract and return the specified parameter in the following format.
#
# field_name=field_value
#
# For example, if fieldname is set to "field1_name", it will return
#
# field1_name=field1_value
#
# The output of this script can be used to set parameters for future requests over
# an internet session.
#
# This script can be called as follows. Assume that a server returns a field
# in the format
#
# <input name="customer" id="customer" value="John Doe"
#
# var str response, customer
# isret "session1" "mainpage.html" > $response
# script "SS_ISFormField.txt" response($response) fieldname("customer") > $customer
# issub "session1" "mystatus.html" $customer
#
# As a result, if the document "mainpage.html" contains the field customer,
# its correct value will be submitted when submitting the document mystatus.html.
#
#####################################################################
# Declare Input Arguments or FVA variables.
var string response
var string fieldname
# Output string.
var str output
var str arg, fieldvalue
set $arg = "^"+"name=\""+$fieldname+"\"&value=\"&\""+"^"
stex -r -c $arg $response > $fieldvalue
stex "^value=\"^]" $fieldvalue > null
stex "[^\"^" $fieldvalue > null
echo ($fieldname+"="+$fieldvalue)
|
|
© 2008-2013, biterScripting.com. All rights reserved.
biterScripting, biterScript, biterBrowser, biterMobile, biterScripting.com, FVA (Forward Variable Assignment) are trademarks of biterScripting.com. Is it biterScripting-compatible ? is a service mark of biterScripting.com.
Explorer, Unix, Windows are trademarks, service marks or other forms of intellectual property of their respective owners.
|
|