1

In my mod_perl2 app, on one page I link to with ?form_field_name=pre_fill_value tacked onto the URI if I want to pre-fill a particular form field for the user. However, the form itself is just <form method=post>, which posts back to the current page, GET query and all. I expected that Apache2::Request's param() routine would serve up either only the POST data, or the POST data first. Instead, it seems the GET data is given precedence, i.e., the prefill is honoured over the manually-user-fixed data.

The easy fix is to add action= and the current URI without the GET query, but I'm wondering why it was designed this way, and if there's a sneaky way around it, like some mod_perl2 option that would give POST data precedence. However, the easy fix can actually cause problems if un-overridden GET query values are expected to be passed on. So this workaround quickly grows, but why is it even this way in the first place?

Kara
  • 6,115
  • 16
  • 50
  • 57
Kev
  • 15,899
  • 15
  • 79
  • 112
  • I'm dealing with a similar problem right now. I'm guessing this has been around since before RESTful programming became a thing. My issue is that data in the query string means something different from the posted data, even if the keys are the same. We were using some perl to parse the query string and body and I decided to switch to Apache2::Request to simplify things. Going back to the old way now. Also, annoying that Apache2::Request treats param keys as case-INsensitive. – ratsbane Feb 19 '15 at 02:29

0 Answers0