View Full Version : ipaddress
gailp
02-03-2007, 03:16 PM
Is there a way to pull the ipaddress of the person submitting the form so I can tell if it is someone local?
dforrestca
02-03-2007, 07:40 PM
See if putting this in the element will do::
$myIP = $_SERVER['REMOTE_ADDR'];
Where myIP is the elementName
gailp
02-03-2007, 08:39 PM
Where do you put the code?
I tried to put it in the javascript action area of the element and I tried to put it in the PHP code to execute on form submission area of the form. But it appears both areas did not work. NO ip info was put into my new myIP element.
Any ideas??? Thanks
dforrestca
02-04-2007, 01:57 AM
Yes, the forms could use a user coding event before the form loads just like they have for post processing. It would have to be processed BEFORE the form displays if you want to see it in the form when it appears. There should be an onLoad java event even if Fabrik does not specify it. Your other option is to put it in the change event of a another field. You may want to search further in the forums for the proper naming convention for using a fabrik element name in java code. Good Luck.
gailp
02-04-2007, 03:20 AM
I have not been able to get anywhere with getting the IPaddress. Any more help would be appreciated.
Thanks,
dforrestca
02-05-2007, 05:56 PM
Try emailing directly to Rob an let him know you NEED an answer to this...he is very helpful.
sorry to reply late to the thread..but you can achieve what your after by doing the following:
create a new field element.
Enter this in the default text:
return $_SERVER['REMOTE_ADDR'];
check the "hidden" checkbox (this hides the field from the user)
check the "eval" checkbox. This tells Fabrik that the default text is in fact php code and to run this code and make the code's output the fields default value.
Save you element and you're done
Cheers
Rob
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.