The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group
Generating a Random String - PHP code
I used the following code to generate a default Random String in a field:
add_filter('frm_get_default_value', 'my_custom_default_value', 10, 2);
function my_custom_default_value($new_value, $field){
if($field->id == 231){ //change 231 to the ID of the field
$length = 10; //change to the string length desired
$randomString = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length);
$new_value = $randomString;
}
return $new_value;
}
April 9, 2014 at 11:08 am
Thanks for this :)
April 3, 2017 at 10:31 pm
This is cool, but where do you use the shortcode and with what syntax?
Discussion closed.