coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 themes/skins/templates => Topic started by: minipoett on March 21, 2006, 12:34:19 AM

Title: "Custom fields for image description"
Post by: minipoett on March 21, 2006, 12:34:19 AM
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.
Title: Re: "Custom fields for image description"
Post by: Joachim Müller on March 21, 2006, 07:07:58 AM
http://forum.coppermine-gallery.net/index.php?topic=7901.0
http://forum.coppermine-gallery.net/index.php?topic=20965.0
http://forum.coppermine-gallery.net/index.php?topic=12369.0
Title: Re: "Custom fields for image description"
Post by: minipoett on March 23, 2006, 10:16:53 AM
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;
}


Title: Re: "Custom fields for image description"
Post by: Joachim Müller on March 23, 2006, 10:35:24 AM
hard to say without a link to your page ::)
Title: Re: "Custom fields for image description"
Post by: minipoett on March 23, 2006, 10:39:19 AM
sorry: www.panopti.de
Title: Re: "Custom fields for image description"
Post by: Joachim Müller on March 23, 2006, 07:32:41 PM
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.
Title: Re: "Custom fields for image description"
Post by: minipoett on March 23, 2006, 08:31:13 PM
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;
}