]> git.immae.eu Git - github/wallabag/wallabag.git/blob - inc/3rdparty/libraries/mpdf/examples/example57_new_mPDF_v5-3_active_forms_b.php
add pdf and mobi libraries
[github/wallabag/wallabag.git] / inc / 3rdparty / libraries / mpdf / examples / example57_new_mPDF_v5-3_active_forms_b.php
1 <?php
2
3
4 include("../mpdf.php");
5
6 $mpdf=new mPDF('');
7
8 //==============================================================
9
10 $html = '
11 <style>
12 textarea {
13 }
14 input {
15 }
16 select {
17 font-family: arialunicodems
18 }
19 </style>
20 <body>
21 <h2>Active Forms</h2>
22
23 <form action="http://127.0.0.1/MPDF1.com/common/mpdf/examples/formsubmit.php" method="post">
24 <b>Input Text</b>
25 <input type="text" size="90" name="inputfield" value="" title="The title attribute works like a tool-tip" />
26 <br /><br />
27
28 <b>Readonly</b>
29 <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" />
30 <br /><br />
31
32 <b>Disabled</b>
33 <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" />
34 <br /><br />
35
36 <b>Required</b>
37 <input type="text" size="90" name="requiredfield" value="" title="This field must be entered before you can submit." required="required" />
38 <br /><br />
39
40 <b>Hidden</b>
41 <input type="hidden" name="hiddenfield" value="value_of_hidden_field">
42 <br /><br />
43
44 <b>Input Password</b>
45 <input type="password" size="40" name="password" value="mysecretpassword" title="This field is set to act as a password field." >
46 <br /><br />
47
48 <b>Calculations</b>
49 <input type="text" size="20" name="maths1" value="0" onChange="var a = this.getField(\'maths1\').value;
50 var b = this.getField(\'maths2\').value;
51 this.getField(\'maths3\').value = a + b;
52 " /> +
53 <input type="text" size="20" name="maths2" value="0" onChange="var a = this.getField(\'maths1\').value;
54 var b = this.getField(\'maths2\').value;
55 this.getField(\'maths3\').value = a + b;
56 " /> =
57 <input type="text" size="20" name="maths3" value="" readonly="readonly"/>
58 <br /><br />
59
60
61 <b>Textarea</b>
62 <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>
63 <br /><br />
64
65
66 <b>First language</b>
67 <select name="first_language" editable="editable">
68 <option value="" >- Please select or type in -</option>
69 <option value="Arabic" >&#1575;&#1604;&#1593;&#1585;&#1576;&#1610;&#1577;</option>
70 <option value="Bulgarian" >&#1073;&#1098;&#1083;&#1075;&#1072;&#1088;&#1089;&#1082;&#1080; &#1077;&#1079;&#1080;&#1082;</option>
71 <option value="Chinese" >&#27721;&#35821;</option>
72 <option value="Czech" >&#269;esky</option>
73 <option value="English" >English</option>
74 <option value="French" >Fran&#231;ais</option>
75 <option value="Greek" >&#917;&#955;&#955;&#951;&#957;&#953;&#954;&#940;</option>
76 <option value="Japanese" >&#26085;&#26412;&#35486;</option>
77 <option value="Latvian" >Latvie&#353;u valoda</option>
78 <option value="Russian" >&#1056;&#1091;&#1089;&#1089;&#1082;&#1086;</option>
79 <option value="Spanish" >Espa&#241;ol</option>
80 <option value="Turkish" >T&#252;rk&#231;e</option>
81 </select>
82 &nbsp;&nbsp;&nbsp;&nbsp;
83
84 You have selected: <input type="text" size="20" name="first_language_display" value="" readonly="readonly" onCalculate="
85 var choice = this.getField(\'first_language\').value;
86 this.getField(\'first_language_display\').value = choice;
87 "/>
88
89 <br /><br />
90
91
92 <div>
93 <b>Spoken language(s)</b><br />
94 <select size="6" multiple="multiple" name="spoken_languages">
95 <option value="Arabic" >&#1575;&#1604;&#1593;&#1585;&#1576;&#1610;&#1577;</option>
96 <option value="Bulgarian" >&#1073;&#1098;&#1083;&#1075;&#1072;&#1088;&#1089;&#1082;&#1080; &#1077;&#1079;&#1080;&#1082;</option>
97 <option value="Chinese" >&#27721;&#35821;</option>
98 <option value="Czech" >&#269;esky</option>
99 <option value="English" selected="selected">English</option>
100 <option value="French" >Fran&#231;ais</option>
101 <option value="Greek" >&#917;&#955;&#955;&#951;&#957;&#953;&#954;&#940;</option>
102 <option value="Japanese" >&#26085;&#26412;&#35486;</option>
103 <option value="Latvian" >Latvie&#353;u valoda</option>
104 <option value="Russian" >&#1056;&#1091;&#1089;&#1089;&#1082;&#1086;</option>
105 <option value="Spanish" >Espa&#241;ol</option>
106 <option value="Turkish" >T&#252;rk&#231;e</option>
107 </select>
108 </div>
109 <br /><br />
110
111
112
113 <b>How many languages do you speak?</b> &nbsp;&nbsp;&nbsp;&nbsp;
114 <input type="radio" name="num_languages" value="1" checked="checked" > One &nbsp;&nbsp;&nbsp;&nbsp;
115 <input type="radio" name="num_languages" value="2" > Two &nbsp;&nbsp;&nbsp;&nbsp;
116 <input type="radio" name="num_languages" value="3" > Three &nbsp;&nbsp;&nbsp;&nbsp;
117 <input type="radio" name="num_languages" value="4" > Four &nbsp;&nbsp;&nbsp;&nbsp;
118 <input type="radio" name="num_languages" value="5" > Five +
119
120 <br /><br />
121
122
123 <input type="checkbox" name="email" value="email_subscrbe" checked="checked" /> Please send me regular information by e-mail<br>
124 <input type="checkbox" name="phone" value="phone-me" disabled="disabled" /> Please phone me (not available at present)<br>
125 <input type="checkbox" name="subscribe" value="newsletter_subscribe" /> Please subscribe me to the Newsletter
126 <br /><br />
127
128 <br /><br />
129
130 Click this button to see Javascript in action:
131 <input type="image" name="imageButton" value="imagesubmitted" src="goto.gif" title="Click to run javascript" onClick="
132 var npass = this.getField(\'password\').value;
133 app.alert(\'Value of password field is: \\\'\' + npass + \'\\\'\');
134 var nButton = app.alert({
135 cMsg: \'Do you want to change the input text field to: T\u00f6rkylempij\u00e4?\',
136 cTitle: \'A message from A. C. Robat\',
137 nIcon: 2, nType: 2
138 });
139 if ( nButton == 4 ) {
140 this.getField(\'inputfield\').value = \'T\u00f6rkylempij\u00e4\';
141 }
142 " />
143
144 <br /><br />
145
146 <input type="submit" name="disabled_submit" value="Disabled" disabled="disabled" title="This Submit button is disabled" />
147
148 <input type="reset" name="resetfield" value="Reset" />
149
150 <input type="submit" name="submit" value="Submit" title="Click here to submit" />
151
152 <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" />
153
154 <input type="button" name="javascriptButton" value="Javascript Button" onClick="
155 var npass = this.getField(\'password\').value;
156 app.alert(\'Value of password field is: \\\'\' + npass + \'\\\'\');
157 var nButton = app.alert({
158 cMsg: \'Do you want to change the input text field to: T\u00f6rkylempij\u00e4?\',
159 cTitle: \'A message from A. C. Robat\',
160 nIcon: 2, nType: 2
161 });
162 if ( nButton == 4 ) {
163 this.getField(\'inputfield\').value = \'T\u00f6rkylempij\u00e4\';
164 }
165 " />
166 <br /><br />
167
168
169 </form>
170 ';
171
172
173 //==============================================================
174 if ($_REQUEST['html']) { echo $html; exit; }
175 if ($_REQUEST['source']) {
176 $file = __FILE__;
177 header("Content-Type: text/plain");
178 header("Content-Length: ". filesize($file));
179 header("Content-Disposition: attachment; filename='".$file."'");
180 readfile($file);
181 exit;
182 }
183
184 //==============================================================
185 $mpdf->useActiveForms = true;
186 $mpdf->formUseZapD = false;
187
188 /*
189 // Try playing around with these (these are also in config.php)
190 $mpdf->formUseZapD = false;
191 $mpdf->formSubmitNoValueFields = true;
192
193 $mpdf->formExportType = 'xfdf'; // 'html' or 'xfdf'
194 $mpdf->formSelectDefaultOption = true; // for Select drop down box; if no option is explicitly maked as selected,
195 // this determines whether to select 1st option (as per browser)
196 // - affects whether "required" attribute is relevant
197 $mpdf->form_border_color = '0.0 0.820 0.0';
198 $mpdf->form_background_color = '0.941 0.941 0.941';
199 $mpdf->form_border_width = '1';
200 $mpdf->form_border_style = 'S';
201
202 $mpdf->form_radio_color = '0.0 0.820 0.0';
203 $mpdf->form_radio_background_color = '0.941 0.5 0.5';
204
205 $mpdf->form_button_border_color = '0.0 0.820 0.0';
206 $mpdf->form_button_background_color = '0.941 0.941 0.941';
207 $mpdf->form_button_border_width = '1';
208 $mpdf->form_button_border_style = 'S';
209 */
210
211 $mpdf->WriteHTML($html);
212
213 //==============================================================
214 // JAVASCRIPT FOR WHOLE DOCUMENT
215 $mpdf->SetJS('
216 var dialogTitle = "Enter details";
217 var defaultAnswer = "";
218 var reply = app.response("This is javascript set to run when the document opens. Enter value for first field", dialogTitle, defaultAnswer);
219 if (reply != null) {
220 this.getField("inputfield").value = reply;
221 }
222 ');
223 //==============================================================
224 // OUTPUT
225 $mpdf->Output(); exit;
226
227
228 //==============================================================
229 //==============================================================
230 //==============================================================
231 //==============================================================
232
233
234 ?>