This is how i have solved it (added to theme’s function.php)
add_action( 'gform_pre_submission', 'pre_submission_handler' );
function pre_submission_handler( $form ) {
for($c=0; $c<count($form["fields"][$c]); $c++) {
if ($form["fields"][$c]["defaultValue"] == "{ip}") {
$id = $form["fields"][$c]["id"];
$_POST['input_' . $id] = $_SERVER["REMOTE_ADDR"];
break;
}
}
}
my form is ajax, not sure if it will help for plain forms