我在这里搜索过,没有找到像我这样的问题所以我希望有人可以提供帮助。
我在一个表单的两个字段中使用Pikaday响应。 “从”日期和“到日期”表格上的所有内容都看起来正常,所选日期在表单字段中正确显示,但由于某种原因,日期不会与表单中的其余数据一起发送。
这是我的HTML:
<p>
<label>BOOK FROM:</label><br />
<input name="bookfrom" type="date" id="date1" required /> <button id="clear" class="SubmitButton">Clear</button>
</p>
<p>
<label>BOOK TO:</label><br />
<input name="bookto" type="text" id="date2" required /> <button id="clear2" class="SubmitButton">Clear</button>
</p>
这是我在页面底部的脚本:
<script src="../js/dependencies/jquery.min.js"></script>
<script src="../js/dependencies/moment.min.js"></script>
<script src="../js/dependencies/pikaday.min.js"></script>
<script src="../js/pikaday-responsive.js"></script>
<script>
var $date1 = $("#date1");
var instance1 = pikadayResponsive($date1, {
format: "Do MMM YYYY",
outputFormat: "X"
});
$date1.on("change", function() {
$("#output1").html($(this).val());
});
$("#clear").click(function() {
instance1.setDate(null);
});
var $date2 = $("#date2");
var instance2 = pikadayResponsive($date2, {
format: "Do MMM YYYY",
outputFormat: "X"
});
$date2.on("change", function() {
$("#output2").html($(this).val());
});
$("#clear2").click(function() {
instance2.setDate(null);
});
</script>
表单发送完以下测试php代码后:
$startdate=$_POST['bookfrom'];
echo 'Date from= ' . $startdate . '<br><br>';
$enddate=$_POST['bookto'];
echo 'Date to= ' . $enddate . '<br><br>';
exit();
返回:
日期=
日期= =
每个=符号后应该有一个日期代码,但没有任何内容。
我应该说我是处理JavaScript /查询的新手,我认为这可能与导致问题的原因有关。我以与表单中其他名称相同的方式给出输入字段名称,其他名称都正确传输。只有这两个日期字段无法通过。
由于JavaScript,应该
$startdate=$_POST['bookfrom'];
和
$enddate=$_POST['bookto'];
是别的什么?我试过了:
$startdate=$_POST['date1'];
echo 'Date from= ' . $startdate . '<br><br>';
$enddate=$_POST['date2'];
echo 'Date to= ' . $enddate . '<br><br>';
exit();
以及使用脚本中的术语而不是输入字段名称但仍然得到相同结果的其他一些变体。
在页面的head标签中我也有:
<link rel="stylesheet" href="../css/pikaday-package.css">
<script src="../js//pikaday-responsive-modernizr.js"></script>
我将不胜感激。
祝福
火车
答案 0 :(得分:1)
这是一个黑暗中的镜头,因为我并不完全熟悉Pikaday,但是当我使用它时,我就这样生成了它:
Range("C17:C25").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Range("A17:C25").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Range("C17:C25").Select
With Selection.Font
.ColorIndex = xlAutomatic
.Name = "Arial"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
所以我的猜测是你错误地生成了它?试一试,但就像我说它是在黑暗中拍摄的。
答案 1 :(得分:0)
我有:
ImageButton
应该是:
<script src="../js//pikaday-responsive-modernizr.js"></script>
惊人的无关/可以做什么: - )