Appnitro Software Forums » MachForm

First address field is not checked?

(9 posts)

  1. MvdL79
    Member

    Hi Yuniar,

    It seems the first address field is not checked? I do not care about the 2nd address field, but the first one is important.

    Please advice on how to enable the check on 1st address field. TY

    Posted 2 years ago #
  2. MvdL79
    Member

    I tried several things, but it just ignores to check the streetname.... :(
    Zip code, etc. it checks fine...

    Please advice...

    Posted 2 years ago #
  3. Hmm.. what do you mean by the first address field is not checked? What checking?

    Posted 2 years ago #
  4. MvdL79
    Member

    I mean the the check if the addres is filled in or if it's empty... :S

    Posted 2 years ago #
  5. I don't believe that Machform is designed to work the way you're thinking.

    The validation is not that specific as to give a message saying for example: "You haven't filled in the postcode field, please try again".

    It seems to be more general as in: "The address details are incomplete; please complete them before continuing".

    Posted 2 years ago #
  6. Hmm.. I think you both are correct.

    The validation for address field is not that specific for each field. It's more general indeed, as "the address details are incomplete".

    However, the first address field should be checked for its value (empty or not), and not the second address field.

    To fix this issue, edit your includes/post-functions.php file.
    Search around line 461 - 474:

    if($element_info[$element_id]['is_required']){
    	$rules[$element_name_3]['required'] = true;
    	$rules[$element_name_4]['required'] = true;
    	$rules[$element_name_5]['required'] = true;
    	$rules[$element_name_6]['required'] = true;
    }
    
    $target_input[$element_name_3] = $user_input[$element_name_3];
    $target_input[$element_name_4] = $user_input[$element_name_4];
    $target_input[$element_name_5] = $user_input[$element_name_5];
    $target_input[$element_name_6] = $user_input[$element_name_6];

    change the above block of code to be like this:

    if($element_info[$element_id]['is_required']){
    	$rules[$element_name]['required'] = true;
    	$rules[$element_name_3]['required'] = true;
    	$rules[$element_name_4]['required'] = true;
    	$rules[$element_name_5]['required'] = true;
    	$rules[$element_name_6]['required'] = true;
    }
    
    $target_input[$element_name]   = $user_input[$element_name];
    $target_input[$element_name_3] = $user_input[$element_name_3];
    $target_input[$element_name_4] = $user_input[$element_name_4];
    $target_input[$element_name_5] = $user_input[$element_name_5];
    $target_input[$element_name_6] = $user_input[$element_name_6];


    That should fix it.

    Posted 2 years ago #
  7. MvdL79
    Member

    Okay I did exactly what you said (I removed the old part and replaced it with the new lines), but now it stays red (as if the fields are not filled in at all)!

    No matter if they fill in the required field, the check continues to say it's not filled in... Arghh....

    Posted 2 years ago #
  8. Hmm.. that's odd. I've tested it and it should be working.
    Can you send me your file please?

    Mail to: customer.service [at] appnitro.com

    Posted 2 years ago #
  9. MvdL79
    Member

    Fixed thanks to Yuniar! :D

    Posted 2 years ago #

RSS feed for this topic

Reply

You must log in to post.