Orderinfo fertig
This commit is contained in:
parent
6c6e850ede
commit
6bbd6346c3
|
@ -5,4 +5,5 @@
|
|||
<a href="detailpage.html">Bücherliste</a><br>
|
||||
<a href="book.html">Buchdetails</a><br>
|
||||
<a href="confirmation.html">Bestätigung</a><br>
|
||||
<a href="shoppingcart.html">Warenkorb</a><br>
|
||||
<a href="shoppingcart.html">Warenkorb</a><br>
|
||||
<a href="orderinfo.html">Bestellinfos</a>
|
|
@ -18,17 +18,15 @@
|
|||
</head>
|
||||
<body>
|
||||
|
||||
<div id="add-address-form" title="Create new user">
|
||||
<p class="validateTips">All form fields are required.</p>
|
||||
|
||||
<div id="add-address-form" title="Addresse hinzufügen">
|
||||
<form>
|
||||
<fieldset>
|
||||
<label for="add-name">Name</label>
|
||||
<input type="text" name="name" id="add-name" value="Jane Smith" class="text ui-widget-content ui-corner-all">
|
||||
<label for="add-email">Email</label>
|
||||
<input type="text" name="email" id="add-email" value="jane@smith.com" class="text ui-widget-content ui-corner-all">
|
||||
<label for="password">Password</label>
|
||||
<input type="password" name="password" id="add-password" value="xxxxxxx" class="text ui-widget-content ui-corner-all">
|
||||
<input type="text" name="name" id="add-name" class="text ui-widget-content ui-corner-all">
|
||||
<label for="add-email">Straße</label>
|
||||
<input type="text" name="email" id="add-email" class="text ui-widget-content ui-corner-all">
|
||||
<label for="add-ort">Ort</label>
|
||||
<input type="text" name="password" id="add-password" class="text ui-widget-content ui-corner-all">
|
||||
|
||||
<!-- Allow form submission with keyboard without duplicating the dialog button -->
|
||||
<input type="submit" tabindex="-1" style="position:absolute; top:-1000px">
|
||||
|
@ -36,17 +34,15 @@
|
|||
</form>
|
||||
</div>
|
||||
|
||||
<div id="add-account-form" title="Create new user">
|
||||
<p class="validateTips">All form fields are required.</p>
|
||||
|
||||
<div id="add-account-form" title="Zahlungsart hinzufügen">
|
||||
<form>
|
||||
<fieldset>
|
||||
<label for="name">Name</label>
|
||||
<input type="text" name="name" id="acc-name" value="Jane Smith" class="text ui-widget-content ui-corner-all">
|
||||
<label for="email">Email</label>
|
||||
<input type="text" name="email" id="acc-email" value="jane@smith.com" class="text ui-widget-content ui-corner-all">
|
||||
<label for="password">Password</label>
|
||||
<input type="password" name="password" id="acc-password" value="xxxxxxx" class="text ui-widget-content ui-corner-all">
|
||||
<label for="name">BIC</label>
|
||||
<input type="text" name="name" id="acc-name" class="text ui-widget-content ui-corner-all">
|
||||
<label for="email">IBAN</label>
|
||||
<input type="text" name="email" id="acc-email" class="text ui-widget-content ui-corner-all">
|
||||
<label for="password">Inhaber</label>
|
||||
<input type="text" name="password" id="acc-password" v class="text ui-widget-content ui-corner-all">
|
||||
|
||||
<!-- Allow form submission with keyboard without duplicating the dialog button -->
|
||||
<input type="submit" tabindex="-1" style="position:absolute; top:-1000px">
|
||||
|
@ -260,7 +256,7 @@
|
|||
|
||||
|
||||
$( function() {
|
||||
var dialog, form,
|
||||
var address, account, account_form, address_form,
|
||||
|
||||
// From http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#e-mail-state-%28type=email%29
|
||||
emailRegex = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,
|
||||
|
@ -270,26 +266,6 @@
|
|||
allFields = $( [] ).add( name ).add( email ).add( password ),
|
||||
tips = $( ".validateTips" );
|
||||
|
||||
function updateTips( t ) {
|
||||
tips
|
||||
.text( t )
|
||||
.addClass( "ui-state-highlight" );
|
||||
setTimeout(function() {
|
||||
tips.removeClass( "ui-state-highlight", 1500 );
|
||||
}, 500 );
|
||||
}
|
||||
|
||||
function checkLength( o, n, min, max ) {
|
||||
if ( o.val().length > max || o.val().length < min ) {
|
||||
o.addClass( "ui-state-error" );
|
||||
updateTips( "Length of " + n + " must be between " +
|
||||
min + " and " + max + "." );
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function checkRegexp( o, regexp, n ) {
|
||||
if ( !( regexp.test( o.val() ) ) ) {
|
||||
o.addClass( "ui-state-error" );
|
||||
|
@ -301,35 +277,16 @@
|
|||
}
|
||||
|
||||
function addUser() {
|
||||
var valid = true;
|
||||
allFields.removeClass( "ui-state-error" );
|
||||
|
||||
valid = valid && checkLength( name, "username", 3, 16 );
|
||||
valid = valid && checkLength( email, "email", 6, 80 );
|
||||
valid = valid && checkLength( password, "password", 5, 16 );
|
||||
|
||||
valid = valid && checkRegexp( name, /^[a-z]([0-9a-z_\s])+$/i, "Username may consist of a-z, 0-9, underscores, spaces and must begin with a letter." );
|
||||
valid = valid && checkRegexp( email, emailRegex, "eg. ui@jquery.com" );
|
||||
valid = valid && checkRegexp( password, /^([0-9a-zA-Z])+$/, "Password field only allow : a-z 0-9" );
|
||||
|
||||
if ( valid ) {
|
||||
$( "#users tbody" ).append( "<tr>" +
|
||||
"<td>" + name.val() + "</td>" +
|
||||
"<td>" + email.val() + "</td>" +
|
||||
"<td>" + password.val() + "</td>" +
|
||||
"</tr>" );
|
||||
dialog.dialog( "close" );
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
dialog = $( "#add-account-form" ).dialog({
|
||||
address = $( "#add-address-form" ).dialog({
|
||||
autoOpen: false,
|
||||
height: 400,
|
||||
width: 350,
|
||||
modal: true,
|
||||
buttons: {
|
||||
"Create an account": addUser,
|
||||
"hinzufügen": addUser,
|
||||
Cancel: function() {
|
||||
dialog.dialog( "close" );
|
||||
}
|
||||
|
@ -340,16 +297,38 @@
|
|||
}
|
||||
});
|
||||
|
||||
form = dialog.find( "form" ).on( "submit", function( event ) {
|
||||
account = $( "#add-account-form" ).dialog({
|
||||
autoOpen: false,
|
||||
height: 400,
|
||||
width: 350,
|
||||
modal: true,
|
||||
buttons: {
|
||||
"hinzufügen": addUser,
|
||||
Cancel: function() {
|
||||
dialog.dialog( "close" );
|
||||
}
|
||||
},
|
||||
close: function() {
|
||||
form[ 0 ].reset();
|
||||
allFields.removeClass( "ui-state-error" );
|
||||
}
|
||||
});
|
||||
|
||||
account_form = account.find( "form" ).on( "submit", function( event ) {
|
||||
event.preventDefault();
|
||||
addUser();
|
||||
});
|
||||
|
||||
address_form = account.find( "form" ).on( "submit", function( event ) {
|
||||
event.preventDefault();
|
||||
addUser();
|
||||
});
|
||||
|
||||
$( "#add-account" ).button().on( "click", function() {
|
||||
dialog.dialog( "open" );
|
||||
account.dialog( "open" );
|
||||
});
|
||||
$( "#add-address" ).button().on( "click", function() {
|
||||
dialog.dialog( "open" );
|
||||
address.dialog( "open" );
|
||||
});
|
||||
} );
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue