Form submit value and char codification problems

edited February 2014 in Bug Reports

I have a php file where I have the configuration my forms. I want to use the same form for create and edit, so, my question is how can I change the submit value in my controller from register to edit?

$config['employee']['form'] = array( 'required_text' => '* Requiered Fields', 'css_class' => '', 'form_attrs' => array('method' => 'post'), 'submit_value' => 'Register', );

My other question is why do I have problems displaying not ascii characters? My html already has the meta with the charset attribute to utf-8. If I do a print_r(); it displays the correct value, but if I set the value to an array, and then that array I use it as parameter to set_field_values(), when the form is displayed with the values it displays "Diseñador" instead of "Diseñador"

This is hoy I'm using it:
$this->form_builder->set_fields($this->form_data['fields']); $employee_values = array( 'first_name' => $employee->first_name, 'last_name' => $employee->last_name, 'email' => $employee->email, 'optional_email' => $employee->optional_email, 'occupation' => $employee->occupation, ); $this->form_builder->set_field_values($employee_values); $data['form'] = $this->form_builder->render_divs();


  • edited 7:25AM
    After you've initiated the form_builder object, you can change the submit_value property on the Form_builder instance like so:
    $this->form_builder->submit_value = 'Edit';

    Regarding the UTF-8 encoding, it appears that the forum used "Diseñador" for both of them. If you view source in your HTML, what is being rendered for the value in the input field?
  • edited 7:25AM
    Sorry, I didn't notice that the forum used "Diseñador" for both of them. What is being rendered is "Dise&amp ;ntilde ;ador"

    I add a white space in my answer before the ";" just to prevent the conversion of the characters.

    This error just happens in the input field, if I echo de value in any other tag like h2, p, and more, it is displayed in the correct form
  • edited 7:25AM
    This sounds like it is being encoded by the Form->prep() method for display purposes and security. The CI form_helper uses a similar method to encode HTML values (like quotes). It uses htmlspecialchars function. Perhaps running htmlspecialchars_decode on the POST request will fix your issue.
Sign In or Register to comment.