forum.coppermine-gallery.net
Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: crl on February 22, 2012, 01:49:54 am
-
I have a problem with gallery users not adding information to the description field when uploading their own images, thjs field needs to be made mandatory. There is a similar old thread using a java script, unfortunately it'd for version 1.3 http://forum.coppermine-gallery.net/index.php/topic,20965.0.html is there a similar script for 1.5?
-
As JavaScript (not Java!) is client-sided it's no reliable way to make a field mandatory. However, as the flash uploader first adds the files to the gallery and the meta album is added later, the only way to make the description field mandatory is to disable the flash uploader for your users and only provide the single HTML upload form. Is this suitable for your gallery?
-
There's no problem disabling the flash uploader and jut use the single HTML uploader. If I go along this route how do I then make the description field mandatory?
-
To reject pictures without a file description, open db_input.php, find
// Test if the filename of the temporary uploaded picture is empty
// getRaw is safe here since this filename is generated by the server
if ($superCage->files->getRaw("/userpicture/tmp_name") == '') {
cpg_die(ERROR, $lang_db_input_php['no_pic_uploaded'], __FILE__, __LINE__);
}
and below, add
if (trim($superCage->post->getRaw("caption")) == '') {
cpg_die(ERROR, 'You need to enter a file description', __FILE__, __LINE__);
}
-
Thank you :)
It works!
-
Does this work for Custom Fields too? If not, how may I may Custom Fields Mandatory?
Thanks in Advance -
-
To make user field 1 mandatory, use something like
if (trim($superCage->post->getRaw("user1")) == '') {
cpg_die(ERROR, 'Your error message here', __FILE__, __LINE__);
}
and so on...
-
Thank You Andre