Hello i created some custom code to test/validate a users input into a gravity form field however I'm somewhat lost please assist me. I have tried for hours to fix this code but it doesn't seem to be getting anywhere at the moment :( sigh i really need some help resolving this
//------------------------------------TESTING THE CODE TO SEE IF IT WORKS!!-----------
add_filter( 'gform_submit_button_1', 'change_validation_message', 10, 2 );
add_filter('gform_validation_message_1', 'change_validation_message', 10, 2);
add_filter('gform_validation_1', 'custom_validation');
function custom_validation($validation_result)
{
$all_airports = array('07430','07495','07446','07458','07645','07656','07642','07648','07640','07642','07647','07656','07677','07676','07498','07675','07401','07458','07463','07423','07676','
07630','07641','07628','07624','07627','07626','07670','07632','07620','07436','07417','07481','07432','07450','07649','07646','07621','07022','07020','07010','07652','07451','07452','07410','07661','
07407','07663','07662','07607','07601','07666','07631','07026','07644','07603','07605','07024','07650','07657','07643','07660','07608','07604','07653','07762','07688','07602','07606','07074','07075','
07057','07072','07073','07070','07071','07031','07032','07856');
$ewr_teb = array('10453','10458','10451','10454','10463','10466','10461','11212','11209','11204','11234','11223','11201','11203','11207','11211','11220','11206','10026','10001','10029','
10010','10012','10004','10002','10021','10023','10031','11361','11354','11365','11412','11101','11374','11691','11004','11414','11368','10302','10306','10301','10457','10467','10452','10455','10471','
10469','10462','11213','11214','11218','11236','11224','11205','11210','11208','11222','11232','11221','10027','10011','10035','10016','10013','10005','10003','10028','10024','10032','11362','11355','
11366','11423','11102','11375','11692','11005','11415','11369','10303','10307','10304','10460','10468','10456','10459','10470','10464','11216','11228','11219','11239','11229','11215','11225','11237','
10030','10018','10017','10014','10006','10009','10044','10025','10033','11363','11356','11367','11432','11103','11379','11693','11411','11416','11370','10310','10308','10305','10037','10019','10022','
10007','10065','10034','11364','11357','11433','11104','11385','11694','11413','11417','11372','10309','10039','10020','10038','10075','10040','11358','11434','11105','11695','11422','11418','11373','
10312','10474','10475','10465','11233','11230','11235','11217','11226','10472','11238','11231','10473','10036','10280','10128','11359','11435','11106','11697','11426','11419','11377','11360','11436','
11427','11420','11378','11428','11421','11429');
if (($_POST['field_1_2']=='EWR - Newark Airport')|| ($_POST['field_1_2']=='TEB - Teterboro Airport'))
{
if ((in_array($_POST['field_1_3'], $ewr_teb) || (in_array($_POST['field_1_3'], $all_airports) ||(in_array($_POST['field_1_4'], $ewr_teb) || (in_array($_POST['field_1_4'], $all_airports))))))
{
$is_valid = true;
$is_postback = false;
}
else
{
$is_postback = true;
$is_valid = false;
}
}
else if (($_POST['field_1_2']=='LGA - LaGuardia Aiport')|| ($_POST['field_1_2']=='JFK - John F. Kennedy Airport'))
{
if ((in_array($_POST['field_1_3'], $all_airports) || (in_array($_POST['field_1_4'], $all_airports))))
{
$is_postback = false;
$is_valid = true;
}
else
{
$is_postback = true;
$is_valid = false;
}
}
else
{
$is_postback = true;
$is_valid = false;
}
}
function change_validation_message($message, $form)
{
return "<div class='validation_error'><strong>Sorry,</strong> we only service areas to/from Bergen County for this airport.</div>";
}
//--------------------------------------------CODE ENDS HERE-----------------------------
Actually looking at the code again you have a function with a parameter being called without a parameter, is it that simple?
Should the function not have a parameter like this
or should the add_filter be passing something