Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
Hi, you can try using the FormUtil function in the JavaScript API to retrieve a form element value Javascript API#getValue(fieldId)
No it is not helpful. Could you be more specific pls.
Your question was "What is syntax to get value from upload element i.e document.getElementById(
'file'
)
is this right?". Based on that link, you can use something like FormUtil.getField("file")
I tried this FormUtil.getField("file") but not getting output.
Hi,
I want to set minimum size of file to be 20kb in my form. Since the upload document property has maximum size limit any way around to achieve this. I tried custom javascript but no luck? Can anyone help...
---------------------------------------------------------------------------
<script>
$('document.getElementById("upload_photo")').change( function()
{
const size =
(this.files[0].size / 1024 / 1024).toFixed(2);
if (size > 4 || size < 2) {
alert("File must be between the size of 2-4 MB");
} else {
}
});
</script>
-------------------------------------------------------------------------------
<script>
Filevalidation = () => {
const fi = document.getElementById(
'file'
);
// Check if any file is selected.
if
(fi.files.length > 0) {
for
(const i = 0; i <= fi.files.length - 1; i++) {
const fsize = fi.files.item(i).size;
const file = Math.round((fsize / 1024));
// The size of the file.
if
(file >= 4096) {
alert(
"File too Big, please select a file less than 4mb"
);
}
else
if
(file < 2048) {
alert(
"File too small, please select a file greater than 2mb"
);
}
else
{
document.getElementById(
'size'
).innerHTML =
'<b>'
+ file +
'</b> KB'
;
}
}
}
}
</script>
---------------------------------------------------------------------------------------------------------------
These are few codes which i tried but not working. What is syntax to get value from upload element i.e
document.getElementById(
'file'
)
is this right?