Appnitro Software Forums » MachForm

Several questions regarding current MachForm.

(10 posts)

  1. MvdL79
    Member

    I am still very content with MachForm. One of the best buys I did in the past.

    However I have a few questions, which were answered in the past, but seeing that MachForm got updated a few times, I would like to ask my questions once again, hopefully they van be answered as well (since the old modifications are out of date).

    Question #1:
    I want to get rid of the "Address Line 2" on my form. Cause it is not used in my country. And while we are at it, is it possible to add a new field for the "House number". Cause I have a lot of clients in the past who seems to forget to enter their house number. :(

    Question #2:
    I want the telephone number to be checked upon 10 digits (International Format). Is this possible?

    Question #3:
    I want to block several email addresses, like Gmail, Hotmail, MSN, Yahoo and such. How do I achieve this. The old modification doesn't work anymore, which I have used in the past. And I really want to avoid order submissions from those emailaccounts.

    Question #4:
    Is it possible to add a Dutch zip code check? All Dutch zip codes are like this: 8523XD
    So it's always 4 numbers followed by 2 letters. Would be very, very nice to have something checking if the first 4 characters are numbers and the last 2 are letters and a total count of 6 characters.

    Question 5:
    Does the modification adding product codes still work, as described here: http://www.appnitro.com/forums/topic/change-in-date-display-in-send-form?replies=21#post-2220

    Before I edit everything, I want to make sure that modification still works with the new MachForm. :)

    Yes, I understand I am asking for a lot, but hopefully someone can help me out here. Would be nice to support someone with an Unlimited License. :)

    Posted 2 years ago #
  2. MvdL79
    Member

    Yuniar, my friend, I need your help! :)

    Posted 2 years ago #
  3. MvdL79
    Member

    Okay I just tried the old modification (Question 5), but doing that results in parsing errors. So I can confirm the old code doesn't work anymore. :(

    Posted 2 years ago #
  4. Hello,

    Sorry for the delay, I'm checking for Question 5 also :) and here is the answers

    1. Try to add these CSS code in your CSS form to hide address line 2:

    #li_1_div_2
    {
    display:none !important;
    }

    In there 1 is your address element_id, you need to change that ID with yours. Anyway I'm afraid you can't add a new field (house no) into address element, since it would take a lot modification to machform code.

    2. If you need "international phone" format has 10 digit, you need to edit "includes/common-validator.php". In line 156 ~ 160, you will see these code :

    if(is_numeric($test_value) && (strlen($test_value) > 3)){
    	return true;
    }else{
    	return $error_message;
    }

    change the code to

    if(is_numeric($test_value) && (strlen($test_value) ==10)){
    	return true;
    }else{
    	return $error_message;
    }

    3. may I know what modification do you have ? maybe i can help you to adjust the code with new version.

    4. Where do you need to add the validation ? in ZIP code address element or single text element ?

    5. I just check the code and it still work on new machform. Hmm .. it's possible to post the code ? i will check for the error.

    Posted 2 years ago #
  5. MvdL79
    Member

    First thanks for taking the time to answer; highly appreciated as always. :)

    I will try 1 & 2.

    3. I really do not know if the code still works, but here is a link to the post, in which Yuniar replied: http://www.appnitro.com/forums/topic/blocking-emailadresses-from-email-field-urgent?replies=6

    4. In the address field's Zip Code (when you add the field address, it also shows the Zip code field, I want that one checked if possible).

    5. Below is the code which used to work in previous versions of MachForm (thanks to Yuniar), however when I use it now. It doesn't work anymore and gives parse errors. Probably it's something small, but I do not understand PHP that well. ;)

    if($data['element_type'] == 'radio' && $target_is_admin === true){
    	if($form_id == 3){
    		if($data['element_id'] == 15){
    
    			if($data['value'] == "eD.50MB webhostingpakket van 45,- Euro per jaar"){
    				$entry_details[$i]['value'] .= " (Product Code: 20006)";
    			}elseif($data['value'] == "eD.100MB webhostingpakket van 70,- Euro per jaar"){
    				$entry_details[$i]['value'] .= " (Product Code: 20000)";
    			}elseif($data['value'] == "eD.200MB webhostingpakket van 90,- Euro per jaar"){
    				$entry_details[$i]['value'] .= " (Product Code: 20001)";
    			}elseif($data['value'] == "eD.400MB webhostingpakket van 118,- Euro per jaar"){
    				$entry_details[$i]['value'] .= " (Product Code: 20003)";
    			}elseif($data['value'] == "eD.600MB webhostingpakket van 148,- Euro per jaar"){
    				$entry_details[$i]['value'] .= " (Product Code: 20004)";
    			}elseif($data['value'] == "eD.1000MB webhostingpakket van 193,- Euro per jaar"){
    				$entry_details[$i]['value'] .= " (Product Code: 20005)";
    			}
    
    		}
    	}

    I will try 1 & 2 in the meantime. Thanks once again.

    //edit #1

    1 & 2 work like a charm! Thanks. :D

    Could #5 become a problem when I use "spaces" as in  

    //edit #2

    Okay I retried the code from #5, this time I didn't get any errors back, however it does not add the product codes after the order form is submitted.

    I used the following code to test it with:

    if($data['element_type'] == 'radio' && $target_is_admin === true){
    	if($form_id == 1){
    		if($data['element_id'] == 7){
    
    			if($data['value'] == "  5 GB ruimte   (€24,- betaling per kwartaal)"){
    				$entry_details[$i]['value'] .= " (Product Code: 20006)";
    			}elseif($data['value'] == "10 GB ruimte   (€48,- betaling per kwartaal)"){
    				$entry_details[$i]['value'] .= " (Product Code: 20000)";
    			}
    
    		}
    	}
    }

    I do not get errors, however it seems to add nothing? I did check the form number and element id, however they are correct. Weird.

    And also, since your looking at it, isn't it possible to add the product codes based on the value? E.g. "5 GB ruimte   (€24,- betaling per kwartaal) is value 1" (first choice), if one selects this and submits the form, I would receive "5 GB ruimte   (€24,- betaling per kwartaal)" + product code?

    I hope you understand what I mean?

    Posted 2 years ago #
  6. Let's Continue the answers ... :)

    3. Yes .. those code should still works

    4. This possible also, to do so you need to edit "includes/post-functions.php" file, go to around line 476, you'll see these code :

    $validation_result = validate_element($target_input,$rules);

    put these code bellow that line

    //custom validation
    $regex  = '/^[0-9]{4}[a-zA-Z]{2}$/';
    $result = preg_match($regex, $user_input[$element_name_5]);
    
    if(empty($result)){
    	$error_elements[$element_id] = "ZIP Code not valid";
    }

    5. I see .. it seems you've missed 1 "}" character in the end of your code. Try to put "}" character to the end of your code. The code will be like this :

    if($data['element_type'] == 'radio' && $target_is_admin === true){
    	if($form_id == 3){
    		if($data['element_id'] == 15){
    
    			if($data['value'] == "eD.50MB webhostingpakket van 45,- Euro per jaar"){
    				$entry_details[$i]['value'] .= " (Product Code: 20006)";
    			}elseif($data['value'] == "eD.100MB webhostingpakket van 70,- Euro per jaar"){
    				$entry_details[$i]['value'] .= " (Product Code: 20000)";
    			}elseif($data['value'] == "eD.200MB webhostingpakket van 90,- Euro per jaar"){
    				$entry_details[$i]['value'] .= " (Product Code: 20001)";
    			}elseif($data['value'] == "eD.400MB webhostingpakket van 118,- Euro per jaar"){
    				$entry_details[$i]['value'] .= " (Product Code: 20003)";
    			}elseif($data['value'] == "eD.600MB webhostingpakket van 148,- Euro per jaar"){
    				$entry_details[$i]['value'] .= " (Product Code: 20004)";
    			}elseif($data['value'] == "eD.1000MB webhostingpakket van 193,- Euro per jaar"){
    				$entry_details[$i]['value'] .= " (Product Code: 20005)";
    			}
    
    		}
    	}
    }
    Posted 2 years ago #
  7. MvdL79
    Member

    Thanks I will give it a go with the zipcode, is it also possible to allow a combination of 3 zipcodes? E.g. Dutch, German and Belgium?

    Dutch: You have already done this for me.
    German: consists out of 5 numbers. For example: 68000
    Belgium: consists out of 4 numers. For example 2910

    Would be nice if it would check one these 3 with submissions.

    5. Please check my updated post. It "works" without errors now, but it doesn't add a product code to the submitted form?

    Posted 2 years ago #
  8. Try to replace my previous custom validation with this :

    $regex_dutch 	= '/^[0-9]{4}[a-zA-Z]{2}$/';
    $regex_german	= '/^[0-9]{5}$/';
    $regex_belgium  = '/^[0-9]{4}$/';
    
    $result_dutch = preg_match($regex_dutch, $user_input[$element_name_5]);
    $result_german = preg_match($regex_german, $user_input[$element_name_5]);
    $result_belgium = preg_match($regex_belgium, $user_input[$element_name_5]);
    
    if(empty($result_dutch) && empty($result_german) && empty($result_belgium))  {
    	$error_elements[$element_id] = "ZIP Code not valid";
    }

    those code will allow a user to sumbit with Dutch, German, Belgium Zip format.

    Anyway your code seems fine, hmmm.. it possible to send your form url ?

    Posted 2 years ago #
  9. MvdL79
    Member

    The zipcode works without problems.

    Here is the link to my form: http://www.backupmaster.nu/bestelformulieren/view.php?id=1
    I rechecked it once more (and removed all the empty extra spaces), but it just will not add the product codes. :(

    I really do not understand what I am doing wrong, it should work right?

    I removed the .htaccess file, so you have access, but please inform me when your done. Thank you.

    //edit

    Maybe the Euro symbol is causing problems? :S

    Posted 2 years ago #
  10. MvdL79
    Member

    LOL... It was caused by the stupid Euro symbol.
    Sigh... I will try and use the ansi code for it and see if that works.

    /me blames Europe!

    //edit

    Seems using &#8364 ; (without space) does work. Sheesh.

    Posted 2 years ago #

RSS feed for this topic

Reply

You must log in to post.