How to use PHP to set the default for the email confirmation field

This is coming up using Gravity View. What I’d like to do is use the email confirmation system so that when someone first fills out a form they need to enter their email twice, but if they use a Gravity View to go back into the form the email confirmation field is already set to match what’s in the primary email field so they don’t have to confirm it every time. This seemed easy enough but I can’t get it work. The key issue seems to be how to set the defaultValue for the email field. Here’s the code snippet I’ve been trying:

foreach( $form['fields'] as &$field ) {
	if($field->id == 7){
		$field->inputs["2"]['defaultValue'] = rgar($entry, "7");

I tried lots of variations on $field->inputs[“2”][‘defaultValue’] and nothing seems to work.

Any ideas! Thanks!

@user62f536a73c7df259, please consult this guide.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.