var win = Ti.UI.currentWindow;

var dateField = Ti.UI.createTextField({
	value: win.record.at.toDateString(),
	hintText: '日付を入力してください',
	top:20, left:50, right:50, height:40,
	borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED
});
win.add(dateField);

var weightField = Ti.UI.createTextField({
	value: win.record.weight,
	hintText: '体重を入力してください',
	top:80, left:50, right:50, height:40,
	borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED
});
win.add(weightField);

var saveButton = Ti.UI.createButton({
	title: 'この値で保存する',
	top:140, left:50, right:50, height:40
});
win.add(saveButton);

saveButton.addEventListener(
'click', function () {
	var record = {};
	record.id = win.record.id;
	record.weight = weightField.value;
	record.at = new Date(dateField.value);
	record.at.setHours(12);
	Ti.App.fireEvent(win.func, record);
	win.close();
});