Autofill a form in WordPress - wordpress

I am using WordPress for building my own website, And I created a form using WP form plugin and users are supposed to fill this form after entering the site and I want parts of the form to be filled automatically for them according to the login information, i.e. name.
So my question is, how can I do this?

You can use jquery or javascript, take ID of that field and run ajax on page load you will get info of use logged in and put that in your field by using jquery parameter .val()

Related

How to pass form input values to another page in Wordpress with Elementor

I have searched the web for answer for almost a day and I couldn't find any answer about that.
Assuming that I'm having a Form created by the simple elementor form widget, and a client inserting a data there(name, email, number) and in another page I have some icon buttons(email, whatsapp, etc..) that should redirect the client to contact me
Like this one:
https://wa.me/1XXXXXXXXXX (Whatsapp start a chat link)
What I want to accomplish is that the input value from "Phone field" will replace the "1XXXXXXX" in the URL after the form is submitted
Is there any way to accomplish that? or any guide?
You can use POST method of php.
All you have to do is to create a page (i.e. submit) and then create a file in your theme folder (rather use child theme) with the name page-submit.php and write down your php code in it (use cpanel/direct admin to edit the file). Also, you should send your form to submit page, use action attribute in your form tag.

wordpress register form to salesforce

I'm wondering if it's possible to use a saleforce form for registering users on wordpress so that when a user registers on the frontend their details are sent to saleforce CRM?
The answer would vary depending on what form tool, if any, you're using, but lately I've been using Gravity Forms and have had great success with connecting to Salesforce via a custom Gravity forms redirect confirmation.
Once you have a form built in Gravity Forms, go to Form Settings > Confirmations. Edit the default Confirmation and change to Type "Redirect". You'll want to post the form to Salesforce's Web-To-Lead API, so enter https://www.salesforce.com/servlet/servlet.WebToLead in the Redirect URL field.
You'll then pass the fields you need via a query string, so check the 'Pass Field Data Via Query String' box, then configure the query string with Salesforce field names and Gravity forms merge tags. There are a couple required parameters including the encoding, your Salesforce Company ID, and a return URL to redirect back to after the form is submitted.
Leave off the ? to begin the query string, so it looks like
encoding=UTF-8&oid=0123456789&retURL=http://example.com
then add fields such as first name, last name, company, country, etc. by adding a parameter for each and selecting the appropriate Gravity Form merge tag from the menu on the right. It will end up looking something like
&first_name={First Name:1}&last_name={Last Name:2}&company={Company:3}
You can also send data to custom fields in Salesforce if you find the field ID. The easiest way to do this is by creating a Web-to-lead form in Salesforce and copying the field's name.
All together, your confirmation should look something like this -
For bonus points, you could add a hidden field to the form for the Return URL and populate it dynamically on the page, either by pulling the current page URL, or adding a custom field to choose a Return URL dynamically.
If you're not using Gravity Forms, you can still use Salesforce's Web-To-Lead tool by creating your own form, or using theirs, and sending the data in a query string.
There are various plugins that allow you to send data to Salesforce from a form, such as WordPress-to-lead for Salesforce CRM.
It is also possible to use the Salesforce API to build a single signon, and register users to or from either service. I built one for SugarCRM, which you can view the code for it at Github to get an idea of how it might work with Salesforce.

Gravity Forms Hide/disable entry creation

I am trying to disable the entry creation for a gravity form I have on my WordPress website. The form consists of username/password for another application (not WordPress) and I do not want it to list/create entries in the WordPress database every time this form is used. I have a dashboard widget also which displays all forms in the website as well as all the entries of each. I am trying to find a way to either hide the form entirely from the widget or not create entries at all.
I tried the following hook,thinking it would stop creating entries.
add_filter("gform_disable_post_creation", "disable_post_creation", 10, 3);
function disable_post_creation($is_disabled, $form, $entry){
return true;
}
But this isn't working. Does anyone know of a way I can hide the form or disable entry creation for this specific form?
While you can’t currently prevent Gravity Forms from creating an entry, you can get the same desired outcome by automatically deleting the entry after the form has finished submitting using the gform_after_submission_{$form['id']} action hook and the Gravity Forms API.
Here's a full tutorial on how to do it manually (disclaimer: I wrote it):
https://gravityplus.pro/how-to/prevent-gravity-forms-entry-creation/
That tutorial also has a link to the plugin I wrote that allows you to simply check a box on the Form Settings page to prevent entry creation and everything is handled for you.

Sitecore Web Forms for Marketers - use current URL within email body

I am trying to build a 'Tell a Friend' form for my Sitecore site using Sitecore's Web Forms for Marketers module and would like to include the URL of the current page within the body of the email. I have set the save action of my form to 'Send Email Message' and was wondering if it would be possible to use some variable to represent the URL of the current page, but can't figure out how to do it.
I noticed that if you link to a page when editing the HTML editor for the email template, the source looks something like this:
Name of page
...so perhaps it is possible to use some similar syntax to get the current context page?
I have also tried setting the save action of my form to 'Tell a Friend' but I can't see how to make this include any email content at all, let alone how to make the email include a link to the current page.
For reference I am using Sitecore 6.5.
I have an idea for this, but its more of a hack. Worth a shot:
Since the Email Editor supports inserting hooks for the dynamic fields (refer to section 4.2.2 of the WFFM User Guide [PDF]), why don't you create a Single-Line Text field on the form, call it "Current Page" and apply a unique CSS class to it (e.g. .current-page)
Using custom CSS, hide the .current-page element and using JavaScript, get the window.location.url and put its value into the .current-page input (the hidden SLT field).
Now you can use the hook [Current Page] in your email body.
Again, this is an untested idea, so I'm not sure if it will work.

Embed registration page on another page in Drupal?

Currently you can get to the registration page by going here: user/register
I need to be able to embed the registration form on ANOTHER page. How do I do that?
You could try the method suggested here: http://drupal.org/node/248275
a.k.a. embed the form using the PHP Code input filter:
<?php
print drupal_get_form('user_register');
?>
However, there will be a few gotchas with trying to embed the user registration page anywhere besides /user/register, because of the way Drupal's User module is set up.
It might be better for you to form_alter the user registration form, so you can customize it to fit your needs. Or, you might be able to get by with adding a block specifically to the user registration page.
What exactly are you trying to achieve by adding the registration page somewhere else?

Resources