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

Yes.

(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]2023/Jan/24: For PHP8

( , JST )

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


jp.Rainbow-Link.com

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