alwanma27
Forum Replies Created
-
Hello,
Thank you for your response.
It works well now and after i have follow your steps:
`replacing this line
Forminator_API::add_form_entries($form_id1, $entry_meta);
with this
Forminator_API::add_form_entry($form_id1, $entry_meta);`
Best Regards
Hello,
I have tried to remove the 2 and make it “text-2” but still not working.
Thank you
Best regardsHello,
Please find the code below:
<?php add_filter('forminator_custom_form_submit_errors', function ($submit_errors, $form_id, $field_data_array) { if ($form_id != 120) { return $submit_errors; } $email = $_POST['email-1']; $serial = $_POST['text-2']; $validate = true; // The commented code below is used for communication with API // But i will check the serial without API now because the checking with API //So let's assume that the entered serial is 1234 // $target_url = ; //URL of the Validation API // // Call the API // $response = wp_remote_post( // $target_url, // array( // 'method' => 'POST', // 'timeout' => 45, // 'headers' => array(), // 'body' => json_encode(array( // "Serial" => $serial, // )), // ) // ); if ($serial !== '1234') { $validate = false; } if (!$validate) { $submit_errors[]['text-2'] = 'Invalid Serial Key'; } else { $form_id1 = 76; $entry_meta = array( array( 'name' => 'text2-2', 'value' => $serial ), array( 'name' => 'email-1', 'value' => $email ) ); Forminator_API::add_form_entries($form_id1, $entry_meta); } return $submit_errors; }, 15, 3);
In the above code I assume that I have write serial as 1234 and that the validation has done correctly then what happen is that the entry is added to the other form but with blank serial instead of 1234 and blank email. So how can we solve this problem.
Thank You
RegardsHello,
I am trying to add the serial number and email as entry to another form using Forminator_API::add_form_entries but each time the entry is saved but with blank value for the serial and email. What can i do in this case?
Thank you
Best RegardsHello,
Thank you for your response i will try it and if i have any questions i will ask here.
Regards
Hello,
It was an API error so that’s why it stop now it works normally but what about my second question
Also i have another question can i print the a custom message on the head of the page instead of the error message shown in the figure below:
ImageThank you
Hello,
The export is in the following link: https://pastebin.com/FsGzG1D0
And i have take the same code you shared above:<?php add_filter( 'forminator_custom_form_submit_errors', function( $submit_errors, $form_id, $field_data_array ) { if( $form_id != 2419 ) { return $submit_errors; } $serial = $_POST['text-2']; // your serial field, update if required. $allowed_keys = '1234'; // Just an example, need to be removed later. $validate = true; // Submit your API here, change the validation field if necessary // ... if( $serial !== '1234' ){ $validate = false; } if( !$validate ){ $submit_errors[]['text-2'] = 'Invalid Serial Key'; } return $submit_errors; },15,3);
but when I write anything in serial number it register the user.
Regards
Hello again,
The code has worked but it stop after a while and now it send all submission i don’t know why so if there is another code to try it. Also i have another question can i print the a custom message on the head of the page instead of the error message shown in the figure below:
Thank you
Hello Patrick,
Thank you for your response i will try it and if i have any questions i will ask here.
Regards
Hello Pawel,
Thank you for your response. I use this user registration form for my company and In the form i have some field that should be filled ( like the serial number of the user that let me make sure that is one of the company client ) and then this serial number will be send on the form submission to an API and based on the API response i want to accept or reject the user.
Thank you
Have a nice weekendHello Zafer,
Hope this message finds you well.
I can’t use conditional logic in my case because what I want to make is: select field A is filled with the name of some company and based on what the user select in select A I have to generate from the database select B field option. For example, The user choose X company in select field A then select B field should be filled with the phone number of staff of this company where the phone number are restored from the database.
Thank you
Best regardsForum: Fixing WordPress
In reply to: Connection RefusedHello @threadi
Deal thank you for your response.
Hello Adam,
Thank you for your help.
Regards,
Hello Adam,
Thank you for your response.
I will try it but what i mean how can i get the upload file url only from the database.
Thank you
RegardsHello Patrick,
Thank you for your response.
Deal for the select value. Now for the upload link i want to get it on form submition to be send it using an api to another location. In other word, I should use it in a code that i have add it in the mu-plugin folder where i have to get the select value and the upload link to send it to my company using API that i have made.
Thank you
Regards