News:

CPG Release 1.6.29
During HTML5 upload, keep pseudo blank code 200 messages from triggering error condition
added Russian language
correct failure to use theme menu icons in album manager
minor vulnerabilities mitigation

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;
}