• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AJAX questions

[eluser]Carlos Mora[/eluser]
Hi ignitors,

I've been learning about using AJAX with forms, using FormTorch as a base.

This works fine, except for a minimal problem, that follows:

There is spans between label and inputs to show eventual errors like

<span class="error" id="nombre_error">
The js routine that submits data updates a <span> label with errors, making


That makes the error message appears, but ads the error message surrounded by a &lt;p&gt; as in:

<span class="error" id="nombre_error">
            <p>El campo nombre es necesario.</p>

where the extra &lt;p&gt; came from? that changes the presentation, &lt;p&gt; is a block tag.

If the ajax data is coming from FormTorch (which I don't know) - then the formatting must be coming from there. Check to see what the output of the JSON data from FormTorch is sending, and remove the <p> tag if necessary.

[eluser]Carlos Mora[/eluser]
Thank you behdesign.
And yes, i'm using formtoch's controller/action,

function process() {


    $fields['nombre'] = 'nombre';

    $rules['nombre'] = 'trim|required';

    if ($this->validation->run() == FALSE) {
        $data = array(
            'nombre' => $this->validation->nombre_error,
                        'success' => FALSE
        echo json_encode($data);
    } else {
        $data = array(
            'nombre' => $this->input->post("nombre")
                $data['success'] = TRUE;


I forgot that "...by default, the Form Validation class adds a paragraph tag (&lt;p&gtWink around each error message shown. You can either change these delimiters globally or individually...."

Thanks again, you directed me to the solution,


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.