Appnitro Software Forums » MachForm 2

image uploading +


  1. alwaysme
    Member

    hello again,

    i am almost done finishing my website, but i just realized that i need the form to accept as many images as the user wants but should not exceed 20

    is there a way i can have a + sign or a link that says "more images" that when clicked the user gets another image browse button, and the more he clicks the more they show? just like how the admin of machform can do it on the back end...i really dont want to put 20 browse buttons on the form...it will look so ugly and unorganized...

    please let me know what i need to do to accomplish this, i also dont mind paying for an hours work.

    thanks!

    Posted 3 years ago #
  2. redityo

    Hi,

    I think you can use this way :

    1. Add all off "file" field to your form and hide it from the user (except first field)
    2. Add some button/link to add or remove the "file" field.

    So the user will get the field one by one, if this way meet your requirement you need to edit "includes/view-functions.php" file,let say you have "file element" with ID from 1 ~ 6 and you will apply on form 1. Then try to follow these steps :

    1. Edit "view-functions.php" file and go to around line 1833 ~ 1834, you will see this :

    //If you would like to remove the "Powered by MachForm" link,..
    $form_markup = <<<EOT

    put these code above that line

    if ($_GET['id'] == 1) {
    	$add_jquery = "
    			<script type=\"text/javascript\">
    				$(document).ready(function(){
    						$('#li_2').hide();
    						$('#li_3').hide();
    						$('#li_4').hide();
    						$('#li_5').hide();
    						$('#li_6').hide();
    				});
    
    				var li_position = 1;
    				var li_max = 6;
    				var li_min = 1;
    
    				function ShowFile() {
    					if (li_position < li_max) {
    						li_position += 1;
    						$('#li_' + li_position).show();
    					}
    				}
    
    				function HideFile() {
    					if (li_position > li_min) {
    						$('#li_' + li_position).hide();
    						li_position -= 1;
    					}
    				}
    			</script>
    	";
    }

    2. Create a section break in your form and add this code to "section break" field label :

    <a href="javascript:ShowFile()">add</a>
    <a href="javascript:HideFile()">Remove</a>

    You also can change the "a" tag to an image link and make sure you've adjust those ID with yours.


    MachForm Support

    Posted 3 years ago #
  3. alwaysme
    Member

    thanks for the tutorial, but i really will not be able to pull that off. What do you mean be all of file?

    Is there any chance you can provide steps for me? for example open filename.php
    edit line etc..

    open
    edit...

    thanks and sorry but i am novice

    Posted 3 years ago #
  4. Hi there, can you send us email directly please?
    Mail to: customer.service [at] appnitro.com


    MachForm Founder

    Posted 3 years ago #
  5. alwaysme
    Member

    done thanks

    Posted 3 years ago #

RSS feed for this topic

Reply