How to force users to fill in all fields during uploading files? How to force users to fill in all fields during uploading files?
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

How to force users to fill in all fields during uploading files?

Started by yacenty, August 20, 2006, 01:36:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

yacenty

Hi, is there any method to force user to fill in all fields when he is uploading picture?
I would like to have anything in title, description and keywords,
Is it hard to modify uploading process to check if there is something in this field?

There is one rule in my gallery that picture has to have all this filed filled in, now I have a lot of work to check if picture has this field when I'm accepting pictures.

I hope sb can help me :)

Kind regards,
YacentY

Sami

You need to put custom javascript:
Disable upload button and check the value of those fields with javascript and enable button when all fields have a value
‍I don't answer to PM with support question
Please post your issue to related board

yacenty

I have no experince in JS, could You give some exapmle how to do it?
Kind regards,
YacentY

Sami

okey you need to change upload.php

- first of all you need to change this (under text_box_input function around line 112)

<input type="text" style="width: 100%" name="$name" maxlength="$max_length" value="$default" class="textinput" />

with this

<input type="text" style="width: 100%" name="$name" maxlength="$max_length" value="$default" class="textinput" onKeyUP="formcheck();" onfocus="formcheck();"/>


- Then you should change this (under text_area_input function around line 159 )

<textarea name="$name" rows="5" cols="40" class="textinput" style="width: 100%;" onKeyDown="textCounter(this, $max_length);" onKeyUp="textCounter(this, $max_length);">$default</textarea>

with this

<textarea name="$name" rows="5" cols="40" class="textinput" style="width: 100%;" onKeyDown="textCounter(this, $max_length);" onKeyUp="textCounter(this, $max_length);formcheck();" onfocus="formcheck();">$default</textarea>


- Then you should change this (under form_alb_list_box function around line 185)

<select name="$name" class="listbox">

with this

<select name="$name" class="listbox" onchange="formcheck();">


- and You need to replace the  open_form function with this new function

function open_form($path) {

    echo <<<EOT
    <script language="javascript" type="text/javascript">
    function textCounter(field, maxlimit) {
            if (field.value.length > maxlimit) // if too long...trim it!
            field.value = field.value.substring(0, maxlimit);
    }
function formcheck(){ // added for fill all fields mod by b.mossavari
for(i=0;i<3;i++){
d=document.forms[i];
if(x=d.caption){
if(d.title.value!='' && d.caption.value!='' && d.keywords.value!=''){
d.sub_button.disabled=false;
}else{
d.sub_button.disabled=true;
}
}
}
}

    </script>
    <form method="post" action="$path" enctype="multipart/form-data" onmouseover="formcheck();">
EOT;
}

and then replace (under close_form function around line 354 )

<input type="submit" value="{$button_value}" class="button" />

with this

<input type="submit" value="{$button_value}" class="button" id="sub_button" name="sub_button"/>


This will disable continue button on http upload form with default setting ;)
‍I don't answer to PM with support question
Please post your issue to related board

yacenty

I did it but unfortunately wrong button is disabled :(
Continue button on page where only files are selected is blocked. even if i put all ten files button is blocked :(

I would like to block button on the page where picture and title, description and keywords are shown :)
is it possible to do it?

Kind regards
YacentY

Sami

Sorry I didn't check that with my test bed ::)
I update my last post and if you follow the steps you'll be fine ;)
‍I don't answer to PM with support question
Please post your issue to related board

yacenty