Jump to content

Cacher le fileupload en fonction de id_contact sélectionné sur le formulaire de contact.


Recommended Posts

  • 2 weeks later...

Je réponds pour les personnes intéressées:

 

<script>
$(document).ready(function(){
    $("div#fileup").hide()
    
    $("select#id_contact").change(function(){
        if ($("select#id_contact option:selected").val() == "3"){
            $("div#fileup").show();
        }else if ($("select#id_contact option:selected").val() !== "3"){
            $("div#fileup").hide();
        }else{
            $("div#fileup").hide();
        }
    });
});
                </script>

 

 

 

{if $fileupload == 1}
                    <div class="form-group" id="fileup">
                        <label for="fileUpload">{l s='Attach File'}</label>
                        <input type="hidden" name="MAX_FILE_SIZE" value="2000000" />
                        <input type="file" name="fileUpload" id="fileUpload" class="form-control" />
                    </div>
                {/if}

 

 

A+

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...