How can I make certain upload fields required? How can I make certain upload fields required?
 

News:

CPG Release 1.6.27
change DB IP storage fields to accommodate IPv6 addresses
remove use of E_STRICT (PHP 8.4 deprecated)
update README to reflect new website
align code with new .com CPG website
correct deprecation in captcha

Main Menu

How can I make certain upload fields required?

Started by erroneus, July 13, 2004, 12:13:24 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

erroneus

When my users upload pictures, I want the title and description to be required fields. How can I do this? Thanks in advance.

erroneus


Joachim Müller

out-of-the-box, this is not possible, so you'll have to code some extra logic that does the checking and prompts the user to fill in the mandatory fields. Since the hack you're requesting is not that trivial, you can't expect people have a solution ready for copy'n paste. It's advisable that you code it using JavaScript if you're not sure about php, with the <form> field code changed to<form ...  onSubmit="return chkForm();" >and the JavaScript bit like this    function chkForm()
    {
     if(document.form_name.field_name.value == "")
      {
       alert("please enter something into 'foobar'");
       document.form_name.field_name.focus();
       return false;
      }


GauGau