logo of RainbowLink Inc.

How to check the users' data ( how to use allpost-contactform.js )

How to add /assets/allpost-contactform.js

(1) Copy /wp-content/plugins/allpost-contactform/assets/allpost-contactform.js to your theme-folder.

(2) Above </header> or above </body> in your theme-file, add allpost-contactform.js like this:

Whether your theme is a parent theme or a child theme, you can add allpost-contactform.js: Copy and paste the complete URL like this:

<script src="https://your-site-name.com/wp-content/themes/your-theme-name/allpost-contactform.js" ></script>

How to create pop-up aleart

(1) Create a list of elements that you'd like to check out like this:


E-mail
postalcode
address
message



(2) Give serial numbers at the line-tops of the list of (1) like this:


1 E-mail
2 postalcode
3 address
4 message



(3) Add


var x"

at the left of the serial numbers of (2) like this:


var x1 E-mail
var x2 postalcode
var x3 address
var x4 message



(4) Add


= document.forms["rl_apcf"]["

between the serial numbers of (3) and elements that you'd like to check out like this:


var x1 = document.forms["rl_apcf"]["E-mail
var x2 = document.forms["rl_apcf"]["postalcode
var x3 = document.forms["rl_apcf"]["address
var x4 = document.forms["rl_apcf"]["message



(5) Add


"].value;

at the right of the elements that you'd like to check out like this:


var x1 = document.forms["rl_apcf"]["E-mail"].value;
var x2 = document.forms["rl_apcf"]["postalcode"].value;
var x3 = document.forms["rl_apcf"]["address"].value;
var x4 = document.forms["rl_apcf"]["message"].value;



(6) Copy (5) and paste it to allpost-contactform.js, under the part of this:


function checkForm() {

//var x1 = document.forms["rl_apcf"]["E-mail"].value;
//var x2 = document.forms["rl_apcf"]["postalcode"].value;
//var x3 = document.forms["rl_apcf"]["address"].value;



If you've done above, your allpost-contactform.js looks like below:


function checkForm() {

//var x1 = document.forms["rl_apcf"]["E-mail"].value;
//var x2 = document.forms["rl_apcf"]["postalcode"].value;
//var x3 = document.forms["rl_apcf"]["address"].value;

var x1 = document.forms["rl_apcf"]["E-mail"].value;
var x2 = document.forms["rl_apcf"]["postalcode"].value;
var x3 = document.forms["rl_apcf"]["address"].value;
var x4 = document.forms["rl_apcf"]["message"].value;



(7) Add a process of "pop-up to urge users to input" to elements that you'd like to check out like this:


if (empty(x1)) {
alert("Would you input your E-mail address?");
return false;
}

if (empty(x2)) {
alert("Would you input your Postal Code?");
return false;
}

if (empty(x3)) {
alert("Would you input your Address?");
return false;
}

if (empty(x4)) {
alert("Would you input your Message?");
return false;
}




(8) Copy (7) and paste it your allpost-contactform.js, under the part of this:


/*
if (empty(x3)) {
alert("Would you input your Address?");
return false;
}
*/



If you've done above, your allpost-contactform.js looks like below:



/*
if (empty(x3)) {
alert("Would you input your Address?");
return false;
}
*/

if (empty(x1)) {
alert("Would you input your E-mail address?");
return false;
}

if (empty(x2)) {
alert("Would you input your Postal Code?");
return false;
}

if (empty(x3)) {
alert("Would you input your Address?");
return false;
}

if (empty(x4)) {
alert("Would you input your Message?");
return false;
}




[Update]
2024/Oct/31: For v1.7.4
2023/Jan/24: For PHP8

( , JST )

このページのURL: https://jp.rainbow-link.com/FAQ.htm?&faq_id=177


jp.Rainbow-Link.com

株式会社レインボーリンク

Cart & MyPage
rainbowlinkinc2