I have a form that uses password_confirm but I can't get the form to accept any values successfully. The password_confirm converts the single field "pass" to two password fields "pass1" and "pass2"

If I use $edit['pass'], Simpletest says there's no such field; if I use $edit['pass1'] and $edit['pass2'] it says they don't exist; if I use $edit['pass'] = array('pass1' => 'xxxxxxx', 'pass2' => 'xxxxxxx') it says "pass" must be a string.

How do I get around this?

Comments

dave reid’s picture

Status: Active » Fixed

You have to look at the HTML of the form and get the value in the 'name' property of the input field. In this case it is "pass[pass1]" and "pass[pass2]".

adaddinsane’s picture

Status: Fixed » Active

I tried $edit['pass'] = array('pass1' => 'xxxxxxx', 'pass2' => 'xxxxxxx') and got "pass must be a string".

What would you suggest?

dave reid’s picture

Status: Active » Fixed

That's not at all what I said. You have to use the literal name of the input fields separately in $edit.

$edit['pass[pass1]'] = 'xxxxx';
$edit['pass[pass2]'] = 'xxxxx';
adaddinsane’s picture

Right. I get it. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.