How do you get/set values from RowEditTemplate during onTemplateClosed client event using javascript? can someone share code with me? Thanks!
Hello davefevold,
Let us know if you need further assistance after the provided by David suggestion.
I've tried the following code to retieve values from a textbox on the RowEdit Template but it doesn't work...what am I doing wrong?
function onTemplateClosing(sender, e) { var grid = sender; var ret = grid.get_behaviors().get_editingCore().get_behaviors().get_rowEditingTemplate(); var oInstrumentNbr = ret.$get({"Instrument_No"}).value;}
Hi,
I would think that would work, so long as the date picker will return you null for the date if it is not set.
-Dave
After using the the same code, the date was null and I still received the following error:
{"String was not recognized as a valid DateTime."}
Any other ideas on how to replace the null date?
Thanks!
When I try to replace the date's null value with the below code, it does not change the date's value when reaching the wdgSecIns_RowUpdating Sub.
var
colKey3 = "Canceled_Date";
datePicker3.set_value(
"12/31/9999");
}
I'm not intimately familar with the WebDatePicker, however when I look at the source code, it appears that it expects a Date object for set_value(), whereas you are passing a string. That could be the source of your problem. Try that and let me know.
thanks,Dave
Dave, it doesn't matter what I put in the set_value() for the date object...I still get the error message. If I have all date fields filled in for the RowEditTemplate, once I press the ok button, the ret closes fine and proceeds to the WebDataGrid_RowUpdating sub. If there is a date field not filled in or null, when I press the ok button, I get the error message and it never proceeds to the WebDataGrid_RowUpdating sub. That is why I'm trying to catch it and change the date before it blows up. Thanks for any help you can provide!
Thanks!!! I appreciiate your help!
For future reference, a lot of these answers can be found in the documentation. This is something available off of the event args. args.get_saveChanges() It is true if it is going to save the changes to the row (ok was clicked) and false otherwise.
Thanks...
Another question...how can I tell if the 'Ok' or 'Cancel' button is clicked?
Off the event args of the event, there should be a cancel method.
args.set_cancel(true);
As for focusing. You already have the dom element or javascript object. If it is an html element, just elem.focus() should do it. If its an object, there is probably a focus() method of some sort that you can call. Or just find an element that's part of the object and focus that.
A couple more questions, how do you keep the RowEditTemplate from closing and assign focus to a field that's in error?