Permalink
Browse files

Add a demo for seperate disply and submit formats

  • Loading branch information...
1 parent f5544a2 commit f11539120840e8e7331bda78a10a757668a054ef @jtsage committed Sep 13, 2012
Showing with 99 additions and 0 deletions.
  1. +1 −0 demos/extras.js
  2. +98 −0 demos/script/split.html
View
1 demos/extras.js
@@ -31,6 +31,7 @@ $(":jqmData(role)=page").live('pageinit', function(e) {
'<li><a href="linksel.html">Linking w/ a Custom Select</a></li>' +
'<li><a href="start.html">Dynamic Start Date</a></li>' +
'<li><a href="maxdays.html">Dynamic Ending Date</a></li>' +
+ '<li><a href="split.html">Different Display and Submit Formats</a></li>' +
'<li><a href="convert.html">Using DateBox as a Conversion Library</a></li>' )
},
sidebarstart = $('<ul data-corners="false" data-role="listview" data-inset="true" data-theme="c" data-dividertheme="f"></ul>');
View
98 demos/script/split.html
@@ -0,0 +1,98 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>jQueryMobile - DateBox Demos</title>
+ <link rel="stylesheet" href="http://code.jquery.com/mobile/latest/jquery.mobile.css" />
+ <link type="text/css" href="http://dev.jtsage.com/cdn/datebox/latest/jqm-datebox.min.css" rel="stylesheet" />
+ <link type="text/css" href="http://dev.jtsage.com/cdn/simpledialog/latest/jquery.mobile.simpledialog.min.css" rel="stylesheet" />
+ <link type="text/css" href="http://dev.jtsage.com/jQM-DateBox/css/demos.css" rel="stylesheet" />
+
+ <!-- NOTE: Script load order is significant! -->
+
+ <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.js"></script>
+ <script type="text/javascript" src="http://code.jquery.com/mobile/latest/jquery.mobile.js"></script>
+ <script type="text/javascript" src="http://dev.jtsage.com/jquery.mousewheel.min.js"></script>
+ <script type="text/javascript" src="http://dev.jtsage.com/cdn/datebox/latest/jqm-datebox.core.min.js"></script>
+ <script type="text/javascript" src="http://dev.jtsage.com/cdn/datebox/latest/jqm-datebox.mode.calbox.min.js"></script>
+ <script type="text/javascript" src="http://dev.jtsage.com/cdn/datebox/latest/jqm-datebox.mode.datebox.min.js"></script>
+ <script type="text/javascript" src="http://dev.jtsage.com/cdn/datebox/latest/jqm-datebox.mode.flipbox.min.js"></script>
+ <script type="text/javascript" src="http://dev.jtsage.com/cdn/datebox/latest/jqm-datebox.mode.durationbox.min.js"></script>
+ <script type="text/javascript" src="http://dev.jtsage.com/cdn/datebox/latest/jqm-datebox.mode.slidebox.min.js"></script>
+ <script type="text/javascript" src="http://dev.jtsage.com/cdn/datebox/i18n/jquery.mobile.datebox.i18n.en_US.utf8.js"></script>
+
+ <script type="text/javascript" src="http://dev.jtsage.com/cdn/simpledialog/latest/jquery.mobile.simpledialog.min.js"></script>
+ <script type="text/javascript" src="http://dev.jtsage.com/jQM-DateBox/demos/extras.js"></script>
+ <script type="text/javascript" src="http://dev.jtsage.com/gpretty/prettify.js"></script>
+ <link type="text/css" href="http://dev.jtsage.com/gpretty/prettify.css" rel="stylesheet" />
+ <script type="text/javascript">
+ $('div').live('pagecreate', function() {
+ prettyPrint()
+ });
+ </script>
+
+</head>
+<body>
+<div data-role="page" data-theme="c" id="timeIndex">
+ <div data-role="header" data-position="fixed">
+ <h1>jQueryMobile - DateBox</h1>
+ <a href="../../" data-icon="home" data-iconpos="notext">Home</a>
+ </div>
+ <div data-role="content" data-theme="c">
+ <div class="content-secondary">
+ <div id="jqm-homeheader">
+ <h1 id="jqm-logo"><img src="../jquery-logo-db.png" alt="jQuery Mobile Framework :: DateBox" /></h1>
+ <p>A Date and Time Picker plugin for jQueryMobile</p>
+ </div>
+
+ <div class="scriptdemos sidebar"></div>
+ </div>
+
+ <div class="content-primary">
+ <div data-role="collapsible-set" data-mini="true" data-theme="c" data-content-theme="d">
+ <div data-role="collapsible" data-collapsed="false">
+ <h2>Different Display and Submit Formats</h2>
+
+ <div data-role="fieldcontain">
+ <label for="split1">Date (D/M/Y)</label>
+ <input name="split1" type="text" data-role="datebox" data-options='{"mode": "datebox", "dateFormatOverride":"%d/%m/%Y"}' id="split1" />
+ <label for="split2">Second Format (Year-Month-Day)</label>
+ <input name="split2" id="split2" type="text">
+ </div>
+
+ <script type="text/javascript">
+ $('#split1').live('datebox', function(e,p) {
+ if ( p.method === 'set') {
+ $('#split2').val(
+ $('#split1').data('datebox')._formatter('%Y-%m-%d', p.date)
+ );
+ }
+ });
+ </script>
+ <p>You can also link inputs easily. (Show with optional 'center popup' option)</p>
+
+ <strong>HTML</strong>
+ <pre class="prettyprint">&lt;label for="split1"&gt;Date (D/M/Y)&lt;/label&gt;
+&lt;input name="split1" type="text" data-role="datebox"
+ data-options='{"mode": "datebox", "dateFormatOverride":"%d/%m/%Y"}' id="split1" /&gt;
+&lt;label for="split2"&gt;Second Format (Year-Month-Day)&lt;/label&gt;
+&lt;input name="split2" id="split2" type="text" /&gt;
+ </pre>
+ <strong>JQuery</strong>
+ <pre class="prettyprint">$('#split1').live('datebox', function(e,p) {
+ if ( p.method === 'set') {
+ $('#split2').val(
+ $('#split1').data('datebox')._formatter('%Y-%m-%d', p.date)
+ );
+ }
+});
+ </pre>
+ </div>
+ </div>
+ </div>
+
+ <div data-role="footer" data-position="fixed">
+ </div>
+</div>
+</html>

0 comments on commit f115391

Please sign in to comment.