Bernd Wurst commited on 2018-01-24 10:34:58
Zeige 2 geänderte Dateien mit 37 Einfügungen und 3 Löschungen.
... | ... |
@@ -0,0 +1,32 @@ |
1 |
+function populate_number(result) { |
|
2 |
+ var field = result.field; |
|
3 |
+ if (result.valid == 1) { |
|
4 |
+ $("#"+field).val(result.number); |
|
5 |
+ $("#"+field+"_feedback").html('<img src="../../images/ok.png" style="height: 16px; width: 16px;" />'); |
|
6 |
+ } else { |
|
7 |
+ $("#"+field+"_feedback").html('<img src="../../images/error.png" style="height: 16px; width: 16px;" alt="Nummer scheint nicht gültig zu sein" title="Nummer scheint nicht gültig zu sein" />'); |
|
8 |
+ } |
|
9 |
+} |
|
10 |
+ |
|
11 |
+function check_number( field ) |
|
12 |
+{ |
|
13 |
+ return function () { |
|
14 |
+ if ($("#"+field).val().length > 0) { |
|
15 |
+ var number = $("#"+field).val(); |
|
16 |
+ var country = $("#land").val(); |
|
17 |
+ $("#"+field).prop("disabled", true); |
|
18 |
+ $.getJSON("numbercheck?number="+encodeURIComponent(number)+"&country="+encodeURIComponent(country)+"&field="+field, populate_number) |
|
19 |
+ .always( function() { |
|
20 |
+ $("#"+field).prop("disabled", false); |
|
21 |
+ }); |
|
22 |
+ } else { |
|
23 |
+ $("#"+field+"_feedback").html(''); |
|
24 |
+ } |
|
25 |
+ } |
|
26 |
+} |
|
27 |
+ |
|
28 |
+$(function() { |
|
29 |
+ $('#telefon').on("change paste", check_number("telefon") ); |
|
30 |
+ $('#mobile').on("change paste", check_number("mobile") ); |
|
31 |
+ $('#telefax').on("change paste", check_number("telefax") ); |
|
32 |
+}); |
... | ... |
@@ -16,6 +16,8 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r |
16 | 16 |
|
17 | 17 |
require_once('contacts.php'); |
18 | 18 |
require_once('inc/debug.php'); |
19 |
+require_once('inc/jquery.php'); |
|
20 |
+javascript(); |
|
19 | 21 |
|
20 | 22 |
require_once('session/start.php'); |
21 | 23 |
|
... | ... |
@@ -62,11 +64,11 @@ $odd = !$odd; |
62 | 64 |
$html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="email">E-Mail-Adresse:</label></td><td><input type="text" name="email" id="email" value="'.$c['email'].'"></td></tr>'; |
63 | 65 |
$odd = !$odd; |
64 | 66 |
|
65 |
-$html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="telefon">Telefonnummer:</label></td><td><input type="text" name="telefon" id="telefon" value="'.$c['phone'].'"></td></tr>'; |
|
67 |
+$html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="telefon">Telefonnummer:</label></td><td><input type="text" name="telefon" id="telefon" value="'.$c['phone'].'"><span id="telefon_feedback"></span></td></tr>'; |
|
66 | 68 |
$odd = !$odd; |
67 |
-$html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="telefon">Mobil:</label></td><td><input type="text" name="mobile" id="mobile" value="'.$c['mobile'].'"></td></tr>'; |
|
69 |
+$html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="telefon">Mobil:</label></td><td><input type="text" name="mobile" id="mobile" value="'.$c['mobile'].'"><span id="mobile_feedback"></span></td></tr>'; |
|
68 | 70 |
$odd = !$odd; |
69 |
-$html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="telefon">Telefax:</label></td><td><input type="text" name="telefax" id="telefax" value="'.$c['fax'].'"></td></tr>'; |
|
71 |
+$html .= '<tr class="'.($odd == true ? 'odd' : 'even').'"><td><label for="telefon">Telefax:</label></td><td><input type="text" name="telefax" id="telefax" value="'.$c['fax'].'"><span id="telefax_feedback"></span></td></tr>'; |
|
70 | 72 |
$odd = !$odd; |
71 | 73 |
|
72 | 74 |
$html .= '<tr class="even"><td> </td><td><input type="submit" value="Speichern" /></td></tr>'; |
73 | 75 |