"Custom fields for image description" "Custom fields for image description"
 

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

"Custom fields for image description"

Started by minipoett, March 21, 2006, 12:34:19 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

minipoett

is there a way to change "Custom fields for image description"-questions from being opional to obligation-questions? my english is bad, but i really want people that upload pix on my page to anwer these questions.


minipoett

hi gau gau,
can these solutions also help me? i tried them, but nothing changed. here s my transformed upload.php-code:

// The open_form function creates the Javascript verification code and the opening form tags.
// $path hold the form action path.
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 chkForm()
{
   if(document.myform.user_field1_name.value == "")
   {
      alert("Please answer question no. 1!");
      document.myform.user_field1_name.focus();
      return false;
   }
}
{
   if(document.myform.user_field2_name.value == "")
   {
      alert("Please answer question no. 2!");
      document.myform.user_field2_name.focus();
      return false;
   }
}
{
   if(document.myform.user_field3_name.value == "")
   {
      alert("Please answer question no. 3!");
      document.myform.user_field3_name.focus();
      return false;
   }
}
{
   if(document.myform.user_field4_name.value == "")
   {
      alert("Please answer question no. 4!");
      document.myform.user_field4_name.focus();
      return false;
   }
}
    </script>
    <form method="post" action="$path" ENCTYPE="multipart/form-data" name="myform" onsubmit="return chkForm();">
EOT;
}



Joachim Müller



Joachim Müller

Try// The open_form function creates the Javascript verification code and the opening form tags.
// $path hold the form action path.
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 chkForm()
{
   if(document.myform.user1.value == "")
   {
      alert("Please answer question no. 1!");
      document.myform.user1.focus();
      return false;
   }
}
{
   if(document.myform.user2.value == "")
   {
      alert("Please answer question no. 2!");
      document.myform.user2.focus();
      return false;
   }
}
{
   if(document.myform.user3.value == "")
   {
      alert("Please answer question no. 3!");
      document.myform.user3.focus();
      return false;
   }
}
{
   if(document.myform.user4.value == "")
   {
      alert("Please answer question no. 4!");
      document.myform.user4.focus();
      return false;
   }
}
    </script>
    <form method="post" action="$path" ENCTYPE="multipart/form-data" name="myform" onsubmit="return chkForm();">
EOT;
}
instead - you of course have to use the actual field names, not placeholders.

minipoett

i tried with your code, but it didn`t work. then i deleted some " } {"  and now its running.  :)  cool, thank you for the help

// The open_form function creates the Javascript verification code and the opening form tags.
// $path hold the form action path.
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 chkForm()
{
   if(document.myform.user1.value == "")
   {
      alert("Please answer question no. 1!");
      document.myform.user1.focus();
      return false;
   }

   if(document.myform.user2.value == "")
   {
      alert("Please answer question no. 2!");
      document.myform.user2.focus();
      return false;
   }

   if(document.myform.user3.value == "")
   {
      alert("Please answer question no. 3!");
      document.myform.user3.focus();
      return false;
   }

   if(document.myform.user4.value == "")
   {
      alert("Please answer question no. 4!");
      document.myform.user4.focus();
      return false;
   }
}
    </script>
    <form method="post" action="$path" ENCTYPE="multipart/form-data" name="myform" onsubmit="return chkForm();">
EOT;
}