This is a migrated thread and some comments may be shown as answers.

datepicker value not send on submit

7 Answers 978 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Budi
Top achievements
Rank 1
Budi asked on 21 Feb 2012, 09:36 AM
please help
I used the date range demo in my code
but when I submit the form the date input is not in the input list
my code is:

<script type="text/javascript">
$().ready(function() {

	function startChange() {
		var startDate = start.value();

		if (startDate) {
			startDate = new Date(startDate);
			startDate.setDate(startDate.getDate() + 1);
			end.min(startDate);
		}
	}

	function endChange() {
		var endDate = end.value();

		if (endDate) {
			endDate = new Date(endDate);
			endDate.setDate(endDate.getDate() - 1);
			start.max(endDate);
		}
	}

	var start = $("#valid_from").width(200).kendoDatePicker({
		change: startChange,
		format: "dd-MM-yyyy"
	}).data("kendoDatePicker");

	var end = $("#valid_to").width(200).kendoDatePicker({
		change: endChange,
		format: "dd-MM-yyyy"
	}).data("kendoDatePicker");

	start.max(end.value());
	end.min(start.value());		
});
</script>

<form action="xxx" method="post">
<input type="hidden" name="request_id" value="9" />
<input type="hidden" name="product_id" value="19" />
<table>
<tr>
	<td><strong>Valid From</strong></td>
	<td> : 
		<input type="text" name="valid_from" value="21-02-2012" id="valid_from" readonly="readonly" maxlength="20" size="20"  />
	</td>
	<td><strong>Valid To</strong></td>
	<td> : 
		<input type="text" name="valid_to" value="21-02-2012" id="valid_to" readonly="readonly" maxlength="20" size="20"  />
	</td>
</tr>
<tr>
	<td colspan="3">
		<input type="submit" name="btnSave" value="Save"  />
		<input type="button" id="btnBack" value="Back" onclick="window.history.back()" />
	</td>
</tr>
</table>
</form>
and when I submit the form the valid_from and valid_to is missing in the POST 
array(6) {
  ["request_id"]=>
  string(1) "9"
  ["product_id"]=>
  string(2) "19"
  ["btnSave"]=>
  string(4) "Save"
}

7 Answers, 1 is accepted

Sort by
0
Phil
Top achievements
Rank 1
answered on 28 Feb 2012, 09:09 PM
anybody have a suggestion on this?
0
Vauneen
Top achievements
Rank 1
answered on 19 Mar 2012, 11:43 AM
Hi,

I have the same problem, my date picker fields are missing from my POST vars array??
So stuck!!
Has anyone found/fixed this?

(This only happens if i edit them, if i edit only other fields in the form, the date picker fields get submitted fine)

Vauneen
0
Sander
Top achievements
Rank 1
answered on 30 Mar 2012, 08:58 AM
[UPDATE]
Forgot to give the field a name...
0
wizmagister
Top achievements
Rank 2
answered on 16 Apr 2012, 04:07 PM
Hello, this is pretty easy to reproduce. 

Put a time picker and a sumbit button on a form. If you edit (entering VALID text) the time picker and click submit right away, the last value is not saved. 

I'd like to know a way to fix this. 

Thanks !

UPDATE:
OK, I did more tests and these didn't worked :
- Opening and closing the control before getting the value
- Setting the focus to another field before getting the value 
- The change event DO happen before the submit, except it pass the old value

The value is OK in the HTML, you can get it like this (though it's not clean !!)
ElapsedControl.Control.element[0].value

instead of 
ElapsedControl.Control.value()

Thanks !
0
Dimo
Telerik team
answered on 16 Apr 2012, 04:32 PM
Hello Marc,

I believe Sander's post points to the root of the problem - according to web standards, input elements require a name attribute in order to be submittable. If your case seems to be different, please provide a demo.

Greetings,
Dimo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
wizmagister
Top achievements
Rank 2
answered on 16 Apr 2012, 04:41 PM
Well, I'm not using an actual submit. I just added a click event to this:
<button id="btnSave" class="ToolbarButton k-button">Save</button>

Then I post the result to the server manually. 

All my input have "id", never used "name". 

Thansk !
0
wizmagister
Top achievements
Rank 2
answered on 16 Apr 2012, 05:44 PM
Hello, I just found out that this is an "old site" (december 2011) and it's using 2011 release of Kendo. Maybe it's an old bug. 

Tags
Date/Time Pickers
Asked by
Budi
Top achievements
Rank 1
Answers by
Phil
Top achievements
Rank 1
Vauneen
Top achievements
Rank 1
Sander
Top achievements
Rank 1
wizmagister
Top achievements
Rank 2
Dimo
Telerik team
Share this question
or