Send a mail on closing the browser tab

时间:2015-05-08 09:52:05

标签: php jquery database forms email

I am currently working on a multistep form, and it has around 100 fields.

Suppose a user start filling the form and completed 30 fields and get harrased. And suddenly the user closes the tab, then a pop up should open as shown in the image below.

Now user enter the email address in a pop up form, and on clicking button, a mail will be send with all the filled values (i.e. 30 fields value).

enter image description here

Is this possible in some other way or this way...Thank you.

1 个答案:

答案 0 :(得分:1)

Use jQuery's Public Function ConcatMatches(ByRef rgFind As Range, ByRef rgSource As Range, ByVal lngOffset As Long) As String Dim rgHit As Range, firstAddress As String, noWrap As Boolean Set rgHit = rgSource.Find(rgFind.Value) 'ensure no wrapping occurs to avoid infinite loops firstAddress = rgHit.Address noWrap = True Dim concat As String While Not (rgHit Is Nothing) And noWrap If concat <> "" Then concat = concat & ", " End If concat = concat & rgHit.Offset(0, lngOffset) 'find next and ensure we didn't wrap back to first hit Set rgHit = rgSource.Find(rgFind.Value, rgHit) noWrap = (firstAddress <> rgHit.Address) Wend ConcatMatches = concat End Function : https://api.jquery.com/unload/

Make a call to the server through jQuery's Public Function GetUniques(rgList As Range) As Variant 'prepare return array matching calling range dimensions Dim CallerRows As Long, CallerCols As Long, CallerAddr As String Dim RowNdx As Long, ColNdx As Long, v As Variant With Application.Caller CallerRows = .Rows.Count CallerCols = .Columns.Count End With Dim Result() As Variant: ReDim Result(1 To CallerRows, 1 To CallerCols) 'fill with result with blank strings For RowNdx = 1 To CallerRows For ColNdx = 1 To CallerCols Result(RowNdx, ColNdx) = "" Next ColNdx Next RowNdx 'filter out uniques Dim dict As Variant: Set dict = CreateObject("Scripting.Dictionary") For Each v In rgList.Cells dict(v.Value) = 1 Next v 'push uniques to first column of resulting array RowNdx = 1 For Each v In dict.Keys() Result(RowNdx, 1) = v RowNdx = RowNdx + 1 Next v GetUniques = Result End Function , and serialize the form data. You'll have to manage the data on the server.