Welcome Guest, Not a member yet? Register   Sign In
Form validation and SELECTs
#3

[eluser]jppi_Stu[/eluser]
Thanks for the input.

What is most confusing to me is how the browser is displaying something that is not supported by the underlying source HTML, as far as pre-selecting an OPTION in the SELECT menu. (However, the validation failure message is visible in the source and the output, so clearly the browser is heeding the source to that extent.)

In fact, if I do a "view source" and copy the whole thing to a new file, and open that new .html file in a browser, it shows what I would expect -- in the example case, Cheddar would be pre-selected because that is what has the SELECTED attribute set. It's only within the context of CodeIgniter redisplaying the form that the underlying source does not match the browser output (and I've checked multiple browsers to see if it was possibly browser-specific).

I'm not too worried about getting the right result in the underlying HTML, as I'm sure I can make that happen, whether or not it's in a CI-friendly way or not. But to have the browser not pre-select the OPTION that has SELECTED set is confounding me.

FWIW, regarding my cheesy example, the controller is loading $this_food like this:
Code:
function grocery_prefs()
{
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
$this->load->model('Grocerymodel');
if ($this->form_validation->run() == FALSE)
  {
  $query = $this->Grocerymodel->grocery_detail($shopper_id);
  $data['this_food'] = $query[0];
  $this->load->view('food_edit_v.php', $data);
  }
# etc...
}


Messages In This Thread
Form validation and SELECTs - by El Forum - 10-19-2010, 02:05 AM
Form validation and SELECTs - by El Forum - 10-19-2010, 03:52 AM
Form validation and SELECTs - by El Forum - 10-19-2010, 03:17 PM
Form validation and SELECTs - by El Forum - 10-19-2010, 03:48 PM
Form validation and SELECTs - by El Forum - 10-19-2010, 04:01 PM
Form validation and SELECTs - by El Forum - 10-19-2010, 07:43 PM
Form validation and SELECTs - by El Forum - 10-19-2010, 07:58 PM



Theme © iAndrew 2016 - Forum software by © MyBB