I am posting to get more information from a previous thread. http://www.appnitro.com/forums/topic/enable-code-in-admin-only-fields?replies=10
To automatically assign a value of a text field to that of a system variable you said to add the following code...
//check for populated value, if exist, use it instead default_value
if(!empty($element->populated_value['element_'.$element->id]['default_value'])){
$element->default_value = $element->populated_value['element_'.$element->id]['default_value'];
}
Right under that block of code, add this code:
if(($_REQUEST['id'] == 12) && ($element->id == 3)){
$element->default_value = $_SESSION['your_session_var'];
}
* My if statement is not being entered. I have changed the request id to that of my form and I can't get through it. I put an echo statement before and inside and can verify that.
* My form will only have 1 test field anyway so I am ok with just setting the default value to always be my session variable.
* When the field is public the variable gets passed with no problems and enters the database.
* When the field is private the value does not get saved in the database.
Is there any other fixes or ways about passing a sessions variable as the default value in an admin text field?