Hi
I really really really am desperate to get some help on a custom event switcher code that I just cannot get right
I'm not new to CF, I'm not new to php... but this situation is absolutly not explainable in my head...
So let's start, the basics...
success or fail
if somethen then fail else success
this works fine:
even this works fine
But hey, don't you dare to use this 'caus it ignores the AND operator for some unexplainable dark reason I just can't see...
WHY WHY WHY?????
Is there any way to debug this? the debugger in the actions is showing variables and values and they are all correct, just the AND operator is busting my b****
At this point I am even willing to pay $100 USD to the one person that can fix this.
Spent hours and days to get the form right, i better wrote the code from scratch. At least that php code obeys written commands.
I really really really am desperate to get some help on a custom event switcher code that I just cannot get right
I'm not new to CF, I'm not new to php... but this situation is absolutly not explainable in my head...
So let's start, the basics...
success or fail
if somethen then fail else success
this works fine:
if $form->data['variable'] = value {
return fail;
} else {
return success;
}
even this works fine
if $form->data['somevariable1] == somevalue OR $form->data['someothervariable'] == somevalue {
return fail;
} else {
return success;
}
But hey, don't you dare to use this 'caus it ignores the AND operator for some unexplainable dark reason I just can't see...
if $form->data['somevariable1] == somevalue OR ($form->data['someothervariable'] == somevalue AND $form->data['someothervariable'] == somevalue ) {
return fail;
} else {
return success;
}
WHY WHY WHY?????
Is there any way to debug this? the debugger in the actions is showing variables and values and they are all correct, just the AND operator is busting my b****
At this point I am even willing to pay $100 USD to the one person that can fix this.
Spent hours and days to get the form right, i better wrote the code from scratch. At least that php code obeys written commands.
Hi chusane!
($form->data['someothervariable'] == somevalue AND $form->data['someothervariable'] == somevalue )
if "somevalue" has different values for the 2 comparsions it can never true!
($form->data['someothervariable'] == somevalue AND $form->data['someothervariable'] == somevalue )
if "somevalue" has different values for the 2 comparsions it can never true!
Hi chaunse,
You need to return a string 'success' with quotes, not just success; and the if clause requires ()
Bob
You need to return a string 'success' with quotes, not just success; and the if clause requires ()
if ( $form->data['somevariable1] == 'somevalue' OR ($form->data['someothervariable'] == 'somevalue' AND $form->data['someothervariable'] == 'somevalue' ) ) {
return 'fail';
} else {
return 'success';
}
Bob
Hi guys,
thank you for your answers, it was very late at night when i made the above post.
I did make some typo's but this is the actual code. It looks fine to me but if you guys find an error in it I would be greatful
it is this string that is ignored
I enter a "stamnr" for people where "Nr_Plaats_tewerkstelling = 3" in the database. Yet they get stopped where my code says they should be allowed since only "Nr_Plaats_tewerkstelling = 1" should be blocked
thank you for your answers, it was very late at night when i made the above post.
I did make some typo's but this is the actual code. It looks fine to me but if you guys find an error in it I would be greatful
it is this string that is ignored
AND $form->data['Nr_Plaats_tewerkstelling'] = 1
I enter a "stamnr" for people where "Nr_Plaats_tewerkstelling = 3" in the database. Yet they get stopped where my code says they should be allowed since only "Nr_Plaats_tewerkstelling = 1" should be blocked
<?php
$niet_toegelaten ='
<p>Beste '.$form->data["Werknemer"].',</p>
<p>U behoort tot een personeelscategorie ('.$form->data["Groep"].') die geen recht heeft op een toegangsbadge of uw standplaats is niet Campus Jette.</p>
<p>Uw personeelscategorie is tevens uitgesloten van de uitzonderingsprocedure, u kan dit formulier niet verder aanvullen.</p>
<p>Indien u van mening bent dat wij niet over de juiste informatie beschikken kan u <a href="mailto:parking@gf.vub.ac.be?SUBJECT=Uitsluiting%20aanvraag%20parking%20Stamnr%20'.$form->data["stamnr"].'%20'.$form->data["Werknemer"].'%20('.$form->data["netid"].')" target="_blank">hier</a> melding maken.
';
//FILTEREN GEKENDE MAAR NIET TOEGELATEN GROEPEN
if ( $form->data['Nr_Groep'] == 1010
OR substr($form->data['Nr_Afd'],0,2) == '11'
OR substr($form->data['Nr_Afd'],0,2) == '12'
OR substr($form->data['Nr_Afd'],0,2) == '13'
OR substr($form->data['Nr_Afd'],0,2) == '14'
OR substr($form->data['Nr_Afd'],0,2) == '15'
OR substr($form->data['Nr_Afd'],0,2) == '17'
OR (substr($form->data['Nr_Afd'],0,2) == '18' AND $form->data['Nr_Plaats_tewerkstelling'] = 1)
OR substr($form->data['Nr_Afd'],0,2) == '19'
OR substr($form->data['Nr_Afd'],0,2) == '26'
OR substr($form->data['Nr_Afd'],0,2) == '28'
OR substr($form->data['Nr_Afd'],0,2) == '29'
OR $form->data['Nr_Afd'] == 301070
OR $form->data['Nr_Afd'] == 301110
OR $form->data['Nr_Afd'] == 302130
OR ($form->data['Nr_Afd'] == 302220 AND $form->data['Nr_Plaats_tewerkstelling'] = 1)
OR $form->data['Nr_Afd'] == 302240
OR $form->data['Nr_Afd'] == 303025
OR $form->data['Nr_Afd'] == 303035
OR $form->data['Nr_Afd'] == 303040
OR $form->data['Nr_Afd'] == 303080
OR $form->data['Nr_Afd'] == 303090
OR $form->data['Nr_Afd'] == 305010
OR $form->data['Nr_Afd'] == 305070
OR $form->data['Nr_Afd'] == 305080
OR $form->data['Nr_Afd'] == 307010
OR $form->data['Nr_Afd'] == 309070
OR $form->data['Nr_Afd'] == 401045
OR ($form->data['Nr_Afd'] == 401050 AND $form->data['Nr_Plaats_tewerkstelling'] = 1)
OR $form->data['Nr_Afd'] == 401070
OR $form->data['Nr_Afd'] == 401080
OR $form->data['Nr_Afd'] == 401200
OR substr($form->data['Nr_Afd'],0,4) == '4020'
OR $form->data['Nr_Afd'] == 403010
OR $form->data['Nr_Afd'] == 403070
OR ($form->data['Nr_Afd'] == 403120 AND $form->data['Nr_Plaats_tewerkstelling'] = 1)
OR $form->data['Nr_Afd'] == 403120
OR substr($form->data['Nr_Afd'],0,4) == '4050'
OR (substr($form->data['Nr_Afd'],0,4) == '4051' AND $form->data['Nr_Plaats_tewerkstelling'] = 1)
OR $form->data['Nr_Afd'] == 405210
OR $form->data['Nr_Afd'] == 405310
OR $form->data['Nr_Afd'] == 406010
OR ($form->data['Nr_Wkg'] == 1 AND ($form->data['Nr_Groep'] == 3001 OR $form->data['Nr_Groep'] == 3012 ))
OR ($form->data['Nr_Wkg'] == 2 AND $form->data['Nr_Groep'] == 3012 )
OR ($form->data['Nr_Wkg'] == 10 AND $form->data['Nr_Groep'] == 4005 AND ($form->data['Nr_Afd'] == 160117 OR $form->data['Nr_Afd'] == 160118 OR $form->data['Nr_Afd'] == 160119 ))
OR $form->data['Nr_Wkg'] == 3
OR $form->data['Nr_Wkg'] == 6
OR $form->data['Nr_Wkg'] == 7
OR $form->data['Nr_Wkg'] == 8
OR $form->data['Nr_Wkg'] == 9
OR $form->data['Nr_Wkg'] == 11
OR $form->data['Nr_Wkg'] == 12
OR $form->data['Nr_Wkg'] == 13
OR $form->data['Nr_Wkg'] == 15
OR $form->data['Nr_Wkg'] == 17
OR $form->data['Nr_Wkg'] == 18
OR $form->data['Nr_Wkg'] == 20
OR $form->data['Nr_Wkg'] == 21
OR $form->data['Nr_Wkg'] == 22
OR $form->data['Nr_Wkg'] == 24
OR $form->data['Nr_Wkg'] == 40
OR $form->data['Nr_Wkg'] == 55
OR $form->data['Nr_Wkg'] == 60
OR $form->data['Nr_Wkg'] == 70
OR ($form->data['Nr_Wkg'] == 80 AND $form->data['Nr_Afd'] != 190030)
OR $form->data['Nr_Wkg'] == 90
OR $form->data['Nr_Wkg'] == 91
OR $form->data['Nr_Wkg'] == 92
OR $form->data['Nr_Wkg'] == 93
OR $form->data['Nr_Wkg'] == 99
OR $form->data['Nr_Wkg'] == 100 ) {
$form->validation_errors['stamnr'] = $niet_toegelaten;
return 'fail';
} else {
return 'success';
}
?>
Argh; i'm stupid (slapping myself)
note to myself: don't work until sunset, you don't see clear :/
note to myself: don't work until sunset, you don't see clear :/
This topic is locked and no more replies can be posted.