Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Automatic file naming
#1
Hello,

is there anyway, that an uploaded document gets its filename automaticly when entering no specific name for it (and not uploading multiple files)?

Best regards,
netCo
Reply
#2
(06-16-2011, 01:22 PM)netco Wrote: Hello,

is there anyway, that an uploaded document gets its filename automaticly when entering no specific name for it (and not uploading multiple files)?

Best regards,
netCo

I think it is very required feature. I ask for it, too
Quote:http://forums.letodms.com/showthread.php?tid=489
I always click add multiply file and add only one (because i rarely need to write any name of file).
"Whatever you do, work at it with all your heart, as working for the Lord, not for human masters". Kol.3:23
Reply
#3
(06-16-2011, 01:22 PM)netco Wrote: Hello,

is there anyway, that an uploaded document gets its filename automaticly when entering no specific name for it (and not uploading multiple files)?

Best regards,
netCo

I decide to do this feature by my own because it is much convenient )
You can simple use linked out.AddDocument.php from attachment.
The changes are:
Quote:<td><?php printMLText("name");?>:</td>
<td><input name="name" size="60">
<input type="checkbox" id="nameused" name="nameused" disabled="disabled" checked="checked" value="1">
<a href="javascript:disableName()"><?php printMLtext("selection") ?></a>
</td>
and
Quote:function disableName()
{
if(document.getElementsByName("userfile[]").length==1){
if(document.form1.nameused.checked==true){
document.form1.nameused.checked=true;
document.form1.name.disabled=true;
}else{
document.form1.nameused.checked=false;
document.form1.name.disabled=false;
}
}
}
Add one line in addFiles function
Quote:function addFiles()
{
document.getElementById("files").innerHTML += '<br><input type="File" name="userfile[]" size="60">';
document.form1.name.disabled=true;
document.form1.nameused.checked=false;
}
And change one line in the function checkform
Quote://if (document.form1.userfile[].value == "") msg += "<?php printMLText("js_no_file");?>\n";
if(!document.form1.name.disabled){
if (document.form1.name.value == "") msg += "<?php printMLText("js_no_name");?>\n";
}
The main concepts are
1) to add checkbox to see if name field is used or not, default checkbox value checked,
2) to add link that will disable use of name field.
It is better to use new text varaible for link but it will need to make changes in all language files.
"Whatever you do, work at it with all your heart, as working for the Lord, not for human masters". Kol.3:23
Reply
#4
It will be part of the next release. If _strictFormCheck in the settings is set to false it will no longer ask for a name.

If you want to fix it in your local copy, just comment out the line

if (document.form1.name.value == "") msg += "<?php printMLText("js_no_name");?>\n";

in out/out.AddDocument.php.

The code itself for uploading a document can handle missing names, but the form validation will not allow to submit the form. If the above line is taken out, it should work.

Uwe
Reply
#5
(07-20-2011, 05:09 PM)steinm Wrote: It will be part of the next release. If _strictFormCheck in the settings is set to false it will no longer ask for a name.

If you want to fix it in your local copy, just comment out the line

if (document.form1.name.value == "") msg += "<?php printMLText("js_no_name");?>\n";

in out/out.AddDocument.php.

The code itself for uploading a document can handle missing names, but the form validation will not allow to submit the form. If the above line is taken out, it should work.

Uwe

Sorry, i forget to copy one small part of code about this from function checkForm()
Quote:if(!document.form1.name.disabled){
if (document.form1.name.value == "") msg += "<?php printMLText("js_no_name");?>\n";
}
"Whatever you do, work at it with all your heart, as working for the Lord, not for human masters". Kol.3:23
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)