mirror of https://github.com/zulip/zulip.git
dialog_widget: Update `get_current_values` function.
Updated `get_current_values` function to not include undefined keys in current_values object and if the input field is of type file and a file is selected then set the value equal to file object.
This commit is contained in:
parent
461d935463
commit
81dfaa0602
|
@ -147,7 +147,14 @@ export function launch(conf: WidgetConfig): void {
|
|||
const current_values: Record<string, unknown> = {};
|
||||
$inputs.each(function () {
|
||||
const property_name = $(this).attr("name")!;
|
||||
current_values[property_name] = $(this).val();
|
||||
if (property_name) {
|
||||
if ($(this).is("input[type='file']") && $(this).prop("files")?.length) {
|
||||
// If the input is a file input and a file has been selected, set value to file object
|
||||
current_values[property_name] = $(this).prop("files")[0];
|
||||
} else {
|
||||
current_values[property_name] = $(this).val();
|
||||
}
|
||||
}
|
||||
});
|
||||
return current_values;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue