I'm working on a form with Form tools http://www.formtools.org
My task is to create php multi-page form, using their API. And it should also save data after every step, not only after the last one.
But I already have a problem while initializing the form into the system.
I have all pages built, and when I'm doing test submission it works good. I successfully see my 'Thank you page'.
Following is the code from my 1st page
<?php
require_once("/app-administration/global/api/api.php");
$fields = ft_api_init_form_page("", "test");
$params = array(
"submit_button" => "submit",
"next_page" => "lc_2.php",
"form_data" => $_POST
);
ft_api_process_form($params);
?>
Then, due to the tutorial, I go to the admin panned, create new form there. And then, I need to initialize it.
So, I'm changing this line:
$fields = ft_api_init_form_page(12, "initialize");
But then, when I try to submit the form I get 100 error on the last page:
http://docs.formtools.org/api/index.php?page=error_codes#100
It says there is something with ID, but 12 is correct one because I have it from admin panel, and I double-checked it there.
Anybody have any ideas why I might have this error? Any help will be appreciated.
Thanks
Related
How can I send the login data (like email) to create account form?
I tried this but not worked:
$data = $this->_view->getLayout()->createBlock('Magento\Customer\Block\Account\Customer');
$data->setData('form_data', ['email' => $login['username']]);
$data->setData('email', $login['username']);
And this:
$item = $this->_objectManager->create('\Magento\Customer\Block\Form\Register');
$item->setData('form_data', ['email' => $resp->username]);
$item->setData('email', $resp->username);
I put this code into {mymodule}\Controller\Account\LoginPost.php execute method.
I'd like to set the default value on registration form by the login email.
Thank You for your help!
You can go to the template file of any registration form then you can directly print the value in input text field.
If it is still not working, share the screenshot if it is possible.
I found a solution:
I put this into my own LoginPost.php
$this->session->setCustomerFormData($data);
Where $data is array.
I am trying to add google identity toolkit in php. Signin option is working correctly but when i am clicking on problem in sign in link it is showing capthca after submitting captcha it is not navigating to any url.
email.php
<?php
include "identity-toolkit-php-client-master/src/GitkitClient.php";
$gitkitClient=new Gitkit_Client();
$oob_response = $gitkitClient->getOobResults($_POST);
$oob_link = $oob_response['oobLink'];
echo json_encode($oob_response);
?>
email.php is the oobactionurl file. when i am using this code I am getting this error .image
You need to create a php file to retrieve and send the reset link to the user. Make sure the oobActionUrl widget option points to this file. Within the file, you'll get the generated link and additional information by calling $gitkitClient->getOobResults($_POST). It should also work if you exclude $_POST, as the function will check the post contents if no arguments are passed. Then, you can get the link itself like this:
$oob_response = $gitkitClient->getOobResults($_POST);
$oob_link = $oob_response['oobLink'];
From there, you can use your email function of choice to send it to the user. The returned array should contain the following.
'email' => email of the user,
'oldEmail' => old email (for ChangeEmail only),
'newEmail' => new email (for ChangeEmail only),
'oobLink' => url for user click to finish the operation,
'action' => 'RESET_PASSWORD', or 'CHANGE_EMAIL',
'response_body' => http response to be sent back to Gitkit widget
Let me know if you have any further questions.
I'm a total noob at programming. I'm currently creating a website where a user can register.
What I want to happen is the following:
When the user registers, he/she will be added to my MailerLite subscriber list.
All the information will also be saved to my website's database.
I played around with the MailerLite documentation but I can't seem to get anything to work.
I installed all the libraries found here: https://github.com/mailerlite/mailerlite-api-php-v1#installation using composer then I created a php file with this code:
`
<?php
require_once 'vendor/autoload.php';
$ML_Subscribers = new MailerLite\Subscribers("*my API*");
$subscriber = array(
'email' => 'first#example.com',
'name' => 'First name'
);
$result = $ML_Subscribers->setId( *my GROUP ID* )->add($subscriber);
?>'
but it appears to do nothing, once I submit the form, it will load the php file that I created and shows nothing, I check my subscriber list in MailerLite and nothing is added.
Please check what does the script return - add var_dump($result); in the end of the file.
And MailerLite doesn't accept "#example.com" emails, so be sure to change this
I have a problem that I am not sure how to fix.
I have a formstack form on my wordpress site. It allows people to buy a product. For this
particular page, there is only one item available for sale, so once the
form is processed (data sent to Formstack->Stripe and payment confirmation received),
the page needs to "turn off" so others can't purchase the item.
Before I used formstack, I used gravity forms plugin.
When the form submitted, I had a add_action filter in my functions.php in
wordpress. It fired when gravity forms completed the submission process and
ran a function that turned off the page.
Here is that code that worked beautifully.
add_action("gform_after_submission", "set_post_content", 10, 2);
function set_post_content(){
global $cfs;
$field_data = array('sold' => '1');
$post_data = array('ID' => get_the_ID()); // the ID is required
$cfs->save($field_data, $post_data);
}
I see formstack has a webhook function.
I cannot seem to find code on how to parse the data the formstack webhook sends. I used http://requestb.in/ to see the data that was being sent.
I believe I need to use php://input, but once I read the data, I am not sure how to say
If formstack webhook fires, then run this code
function set_post_content(){
global $cfs;
$field_data = array('sold' => '1');
$post_data = array('ID' => get_the_ID()); // the ID is required
$cfs->save($field_data, $post_data);
}
I also believe the code needs to be in the functions.php in my theme file because otherwise it won't understand the $cfs variable that is from another wordpress plugin.
I saw this new formstack function the other day - it sounds like it could solve your problem?http://support.formstack.com/customer/portal/articles/1444519-event-fields
Event handling options
When your Event has filled to capacity, you can mark the Event as "Sold Out" so new submitters will see the item is no longer available. You may also choose to hide this field on the Form once the items have sold out. Additionally, you can deactivate the whole Form when the Event has sold out; this is done through the Form Settings tab > General > Deactivate Form settings.
I'm trying to add a form button that will take a variable string and insert it into $_POST['message'], such that when someone presses my 'post this on forum' button it takes them to the new topic page with my variable string already in the message textarea.
I've been messing with submit_post and have a form that submits a new post correctly when it's completed, however I don't want it to submit straight away; all I want is for it to load posting.php with my string already in the message field. Does anyone have any ideas?
You might have to modify the source of phpBB3 in order to do this. Unless posting.php is programmed to accept data from $_POST and insert it into the message textarea, you'll have to program it to do so.
As an alternative, you could try doing this with JavaScript: You could pass the text to posting.php in a cookie or a session variable which then displays in a hidden div or textarea or some other means (I'd need more specific information about your environment to provide specifics) and then insert that text into the textarea using JavaScript after the page loads. This should be more upgrade safe, but obviously requires users to have JavaScript enabled.
I found an alteration you can make to posting.php to let it accept get parameters
http://www.phpbb.com/community/viewtopic.php?f=46&t=2119831
Here it is for the sake of completion:
Find the following in posting.php:
if ($submit || $preview || $refresh)
Add the following on a line before it:
if( !$submit&& !$preview&& !$refresh&& !$save&& !$load&& !$delete&& !$cancel&& ( $mode== 'post'|| $mode== 'reply'|| $mode== 'quote' ) ) {
$post_data['post_subject']= utf8_normalize_nfc( request_var( 'subject', '', TRUE ) );
$message_parser->message= utf8_normalize_nfc( request_var( 'message', '', TRUE ) );
Voila! Test it with http://yourdomain/forum/posting.php?mode=post&f=2&subject=hello&message=world