Commit 9abfcfa3 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

efa: Show possible alternatives when receiving ambiguous input

parent 7ee990de
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -90,6 +90,20 @@ $www->submit_form(

$content = $www->content;

# ambiguous input
if ($content =~ /<span class="errorTextBold">Bitte auswählen<\/span>/s) {
	print STDERR "Ambiguous input for ";
	if ($content =~ /<select name="(?<what>(place|type|name)_(origin|destination))"/) {
		print STDERR "$+{what}\n";
	} else {
		print STDERR "unknown\n";
	}
	while ($content =~ /<option value="\d+:\d+"( selected)?>(?<choice>[^<]+)<\/option>/gs) {
		print STDERR "\t$+{choice}\n";
	}
	exit(1);
}

foreach (split(/<span class="labelTextBold"> \d+\. Fahrt<\/span>/, $content)) {
	unless ($offer) {
		$offer++;