Open popfaker opened 4 years ago
<form action="test.php" method="post"> <p><input type="text" name="name" value="" /></p> <p><input type="text" name="passwd" value="" /></p> <p style="visibility:hidden;"><input type="text" name="area" value="-1" /></p> <p><input type="image" id="btn" src="" /></p> </form>
$crawler = $client->request('GET', 'http://xxxx.com/'); $form = $crawler->selectButton('btn')->form(); dd($form->get('area')->getValue());
print -1
print NULL
$crawler = $client->request('GET', 'http://xxxx.com/'); $form = $crawler->selectButton('btn')->form(); $form->disableValidation(); $form->get('area')->setValue('-1'); dd($form->get('area')->getValue());
The expected results
print -1
The actual results
print NULL
The solution