aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/3rdparty/libraries/mpdf/examples/example57_new_mPDF_v5-3_active_forms.php
blob: 2427f5a6f65040e9dda26470964b6ed048a79463 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<?php


include("../mpdf.php");

$mpdf=new mPDF(''); 

//==============================================================

$html = '
<style>
textarea {
}
input {
}
select {
	font-family: arialunicodems
}
</style>
<body>
<h2>Active Forms</h2>

<form action="http://127.0.0.1/MPDF1.com/common/mpdf/examples/formsubmit.php" method="post">
<b>Input Text</b>
<input type="text" size="90" name="inputfield" value="" title="The title attribute works like a tool-tip" /> 
<br /><br />

<b>Readonly</b>
<input type="text" size="90" name="readonlyfield" value="Read-only field. The value will be exported on submit" title="The title does not do anything if the field is read-only" readonly="readonly" /> 
<br /><br />

<b>Disabled</b>
<input type="text" size="90" name="disabledfield" value="Disabled field. The value will not be exported on submit" title="The title does not do anything if the field is disabled." disabled="disabled" /> 
<br /><br />

<b>Required</b>
<input type="text" size="90" name="requiredfield" value="" title="This field must be entered before you can submit." required="required" /> 
<br /><br />

<b>Hidden</b>
<input type="hidden" name="hiddenfield" value="value_of_hidden_field"> 
<br /><br />

<b>Input Password</b>
<input type="password" size="40" name="password" value="mysecretpassword" title="This field is set to act as a password field." > 
<br /><br />

<b>Calculations</b>
<input type="text" size="20" name="maths1" value="0" onChange="var a = this.getField(\'maths1\').value;
var b = this.getField(\'maths2\').value;
this.getField(\'maths3\').value = a + b;
" /> + 
<input type="text" size="20" name="maths2" value="0" onChange="var a = this.getField(\'maths1\').value;
var b = this.getField(\'maths2\').value;
this.getField(\'maths3\').value = a + b;
" /> = 
<input type="text" size="20" name="maths3" value="" readonly="readonly"/> 
<br /><br />


<b>Textarea</b>
<textarea name="textareafield" spellcheck="true" rows="5" cols="80" wrap="virtual" title="Textarea tooltip">Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. </textarea>
<br /><br />


<b>First language</b>
<select name="first_language" editable="editable" onChange="
var choice = this.getField(\'first_language\').value;
this.getField(\'first_language_display\').value = choice;
">
<option value="" >- Please select or type in -</option>
<option value="Arabic" >&#1575;&#1604;&#1593;&#1585;&#1576;&#1610;&#1577;</option>
<option value="Bulgarian" >&#1073;&#1098;&#1083;&#1075;&#1072;&#1088;&#1089;&#1082;&#1080; &#1077;&#1079;&#1080;&#1082;</option>
<option value="Chinese" >&#27721;&#35821;</option>
<option value="Czech" >&#269;esky</option>
<option value="English" >English</option>
<option value="French" >Fran&#231;ais</option>
<option value="Greek" >&#917;&#955;&#955;&#951;&#957;&#953;&#954;&#940;</option>
<option value="Japanese" >&#26085;&#26412;&#35486;</option>
<option value="Latvian" >Latvie&#353;u valoda</option>
<option value="Russian" >&#1056;&#1091;&#1089;&#1089;&#1082;&#1086;</option>
<option value="Spanish" >Espa&#241;ol</option>
<option value="Turkish" >T&#252;rk&#231;e</option>
</select> 
&nbsp;&nbsp;&nbsp;&nbsp; 

You have selected: <input type="text" size="20" name="first_language_display" value="" readonly="readonly"/> 

<br /><br />


<div>
<b>Spoken language(s)</b><br />
<select size="6" multiple="multiple" name="spoken_languages">
<option value="Arabic" >&#1575;&#1604;&#1593;&#1585;&#1576;&#1610;&#1577;</option>
<option value="Bulgarian" >&#1073;&#1098;&#1083;&#1075;&#1072;&#1088;&#1089;&#1082;&#1080; &#1077;&#1079;&#1080;&#1082;</option>
<option value="Chinese" >&#27721;&#35821;</option>
<option value="Czech" >&#269;esky</option>
<option value="English" selected="selected">English</option>
<option value="French" >Fran&#231;ais</option>
<option value="Greek" >&#917;&#955;&#955;&#951;&#957;&#953;&#954;&#940;</option>
<option value="Japanese" >&#26085;&#26412;&#35486;</option>
<option value="Latvian" >Latvie&#353;u valoda</option>
<option value="Russian" >&#1056;&#1091;&#1089;&#1089;&#1082;&#1086;</option>
<option value="Spanish" >Espa&#241;ol</option>
<option value="Turkish" >T&#252;rk&#231;e</option>
</select> 
</div>
<br /><br />



<b>How many languages do you speak?</b> &nbsp;&nbsp;&nbsp;&nbsp; 
<input type="radio" name="num_languages" value="1" checked="checked" > One &nbsp;&nbsp;&nbsp;&nbsp; 
<input type="radio" name="num_languages" value="2" > Two &nbsp;&nbsp;&nbsp;&nbsp; 
<input type="radio" name="num_languages" value="3" > Three &nbsp;&nbsp;&nbsp;&nbsp; 
<input type="radio" name="num_languages" value="4" > Four &nbsp;&nbsp;&nbsp;&nbsp; 
<input type="radio" name="num_languages" value="5" > Five + 

<br /><br />


<input type="checkbox" name="email" value="email_subscrbe" checked="checked" /> Please send me regular information by e-mail<br>
<input type="checkbox" name="phone" value="phone-me" disabled="disabled" /> Please phone me (not available at present)<br>
<input type="checkbox" name="subscribe" value="newsletter_subscribe" /> Please subscribe me to the Newsletter
<br /><br />

<br /><br />

Click this button to see Javascript in action: 
<input type="image" name="imageButton" value="imagesubmitted" src="goto.gif" title="Click to run javascript" onClick="
var npass = this.getField(\'password\').value;
app.alert(\'Value of password field is: \\\'\' + npass + \'\\\'\');
var nButton = app.alert({
cMsg: \'Do you want to change the input text field to: T\u00f6rkylempij\u00e4?\',
cTitle: \'A message from A. C. Robat\',
nIcon: 2, nType: 2
});
if ( nButton == 4 ) {
this.getField(\'inputfield\').value = \'T\u00f6rkylempij\u00e4\';
}
" />

<br /><br />

<input type="submit" name="disabled_submit" value="Disabled" disabled="disabled" title="This Submit button is disabled" /> 

<input type="reset" name="resetfield" value="Reset" />

<input type="submit" name="submit" value="Submit" title="Click here to submit" /> 

<input type="submit" name="submit_in_Turkish" value="Submit (T&#252;rk&#231;e)" title="Click here to submit in T&#252;rk&#231;e" /> 

<input type="button" name="javascriptButton" value="Javascript Button" onClick="
var npass = this.getField(\'password\').value;
app.alert(\'Value of password field is: \\\'\' + npass + \'\\\'\');
var nButton = app.alert({
cMsg: \'Do you want to change the input text field to: T\u00f6rkylempij\u00e4?\',
cTitle: \'A message from A. C. Robat\',
nIcon: 2, nType: 2
});
if ( nButton == 4 ) {
this.getField(\'inputfield\').value = \'T\u00f6rkylempij\u00e4\';
}
" />
<br /><br />


</form>
';


//==============================================================
if ($_REQUEST['html']) { echo $html; exit; }
if ($_REQUEST['source']) { 
	$file = __FILE__;
	header("Content-Type: text/plain");
	header("Content-Length: ". filesize($file));
	header("Content-Disposition: attachment; filename='".$file."'");
	readfile($file);
	exit; 
}

//==============================================================
$mpdf->useActiveForms = true;

/*
// Try playing around with these (these are also in config.php)
$mpdf->formUseZapD = false;
$mpdf->formSubmitNoValueFields = true;

$mpdf->formExportType = 'xfdf'; // 'html' or 'xfdf'
$mpdf->formSelectDefaultOption = true;	// for Select drop down box; if no option is explicitly maked as selected,
							// this determines whether to select 1st option (as per browser)
							// - affects whether "required" attribute is relevant
$mpdf->form_border_color = '0.0 0.820 0.0'; 
$mpdf->form_background_color = '0.941 0.941 0.941';
$mpdf->form_border_width = '1';
$mpdf->form_border_style = 'S';

$mpdf->form_radio_color = '0.0 0.820 0.0'; 
$mpdf->form_radio_background_color = '0.941 0.5 0.5';
 
$mpdf->form_button_border_color = '0.0 0.820 0.0'; 
$mpdf->form_button_background_color = '0.941 0.941 0.941';
$mpdf->form_button_border_width = '1';
$mpdf->form_button_border_style = 'S';
*/

$mpdf->WriteHTML($html);

//==============================================================
// JAVASCRIPT FOR WHOLE DOCUMENT
$mpdf->SetJS('
var dialogTitle = "Enter details";
var defaultAnswer = "";
var reply = app.response("This is javascript set to run when the document opens. Enter value for first field", dialogTitle, defaultAnswer);
if (reply != null) { 
this.getField("inputfield").value = reply;
}
');
//==============================================================
// OUTPUT
$mpdf->Output(); exit;


//==============================================================
//==============================================================
//==============================================================
//==============================================================


?>