This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 4

Show how many spots are left (Limit Form Submission)


  1. presbyran
    Member

    Hi

    Just wanna know if there is any way how to show how many entries are left for the form.

    Example:
    I create a form and allow max 5 entries to be saved before the form gets disabled.
    I wanna show on the form that there is 3 enries left of 5 for the users, so they know how many spots are left.

    Is this possible?

    Thanks

    Posted 9 years ago #
  2. presbyran
    Member

    Nobody?

    Posted 9 years ago #
  3. quadrant2
    Member

    That would be an awesome feature!!

    Posted 8 years ago #
  4. redityo

    I'm afraid currently there is no function to show remaining entries on the form.
    But if you don't mind with the customization, you can create custom code to show remaining entries in the top of your forms.

    To do this, edit includes/view-functions.php file and go to around line 5324, you will see these codes :

    //if advanced form code being used, display the form without body container
    if($integration_method == 'php'){

    then put these custom code above that line

    //custom code
    		if ( !empty($form->limit_enable) && $form->limit_enable == 1){
    			$query = "select count(1) total_entries from ".MF_TABLE_PREFIX."form_{$form_id} where <code>status</code> = 1";
    			$params = array();
    
    			$sth = mf_do_query($query,$params,$dbh);
    			$row = mf_do_fetch_result($sth);
    			$remain_count = $form->limit - $row['total_entries'];
    			$remain_entries_message = <<<EOT
    				<li class="remain_entries">
    					Remain {$remain_count} entries of {$form->limit }
    				</li>
    EOT;
    		}

    then go to line 5380 and 5428, you will see these code :

    {$payment_total_markup_top}

    and change the code to be like this

    {$payment_total_markup_top}
    {$remain_entries_message}

    MachForm Support

    Posted 8 years ago #

RSS feed for this topic

Reply