@@ -1218,10 +1218,14 @@ Func _WinHttpSimpleFormFill(ByRef $hInternet, $sActionPage = Default, $sFormId =
1218
1218
$sMethod = __WinHttpAttribVal($sAttributes , " method" )
1219
1219
; Requested form is found. Set $fSend flag to true
1220
1220
$fSend = True
1221
+ $sHTML = StringReplace ($sHTML , $sForm , " >" )
1221
1222
Local $sSpr1 = Chr (27 ), $sSpr2 = Chr (26 )
1222
1223
__WinHttpNormalizeForm($sForm , $sSpr1 , $sSpr2 )
1223
1224
$aInput = StringRegExp ($sForm , " (?si)<\h*(?:input|textarea|label|fieldset|legend|select|optgroup|option|button)\h*(.*?)/*\h*>" , 3 )
1225
+ ; HTML5 "form" attribute on form elements
1226
+ __WinHttpHTML5Form($sHTML , $sId , @error , $aInput )
1224
1227
If @error Then Return SetError (2 , 0 , " " ) ; invalid form
1228
+ $sHTML = " "
1225
1229
; HTML5 allows for "formaction", "formenctype", "formmethod" submit-control attributes to be set. If such control is "clicked" then form's attributes needs updating/correcting
1226
1230
__WinHttpHTML5FormAttribs($aDtas , $aFlds , $iNumParams , $aInput , $sAction , $sEnctype , $sMethod )
1227
1231
; Workout correct URL, scheme, etc...
@@ -2103,6 +2107,23 @@ Func __WinHttpNormalizeActionURL($sActionPage, ByRef $sAction, ByRef $iScheme, B
2103
2107
If $sMethod = " GET" Then $sEnctype = " "
2104
2108
EndFunc
2105
2109
2110
+ Func __WinHttpHTML5Form($sHTML , $sId , $iFormErr , ByRef $aInput )
2111
+ If $sId Then
2112
+ If $iFormErr Then Dim $aInput [1 ]
2113
+ $aInputHTML5 = StringRegExp ($sHTML , " (?si)<\h*(?:input|textarea|label|fieldset|legend|select|optgroup|option|button)\h*(.*?)/*\h*>" , 3 )
2114
+ If Not @error Then
2115
+ For $sElem In $aInputHTML5
2116
+ If __WinHttpAttribVal($sElem , " form" ) = $sId Then
2117
+ $iFormErr = 0
2118
+ ReDim $aInput [UBound ($aInput ) + 1 ]
2119
+ $aInput [UBound ($aInput ) - 1 ] = $sElem
2120
+ EndIf
2121
+ Next
2122
+ EndIf
2123
+ EndIf
2124
+ Return SetError ($iFormErr , 0 , " " )
2125
+ EndFunc
2126
+
2106
2127
Func __WinHttpHTML5FormAttribs(ByRef $aDtas , ByRef $aFlds , ByRef $iNumParams , ByRef $aInput , ByRef $sAction , ByRef $sEnctype , ByRef $sMethod )
2107
2128
; Clicking "submit" is done using:
2108
2129
; "type:submit", zero_based_index_of_the_submit_button
0 commit comments