Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: "Custom fields for image description"  (Read 6109 times)

0 Members and 1 Guest are viewing this topic.

minipoett

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 54
"Custom fields for image description"
« 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.
« Last Edit: March 24, 2006, 07:47:25 am by GauGau »
Logged

minipoett

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 54
Re: "Custom fields for image description"
« Reply #2 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:

Code: [Select]
// 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;
}


Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: "Custom fields for image description"
« Reply #3 on: March 23, 2006, 10:35:24 am »

hard to say without a link to your page ::)
Logged

minipoett

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 54
Re: "Custom fields for image description"
« Reply #4 on: March 23, 2006, 10:39:19 am »

Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: "Custom fields for image description"
« Reply #5 on: March 23, 2006, 07:32:41 pm »

Try
Code: [Select]
// 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.
Logged

minipoett

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 54
Re: "Custom fields for image description"
« Reply #6 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

Code: [Select]
// 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;
}
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 19 queries.