• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
2 form error

#1
[eluser]Yash[/eluser]
When I try to load 2 form on page ..one's < form > get truncated.

2 form on same view coming from 2 different views.

Code:
<?php              
    $attributes = array('class' => 'search', 'id' => 'search');
    
    echo form_open('blog/do_search', $attributes);
    
    ?>
  <p>  &lt;form&gt; &lt;input type="text" name="blog_search" id="blog_search" /&gt;
  </p>
  <p>
    <select name="search_area" id="search_area">
      <option value="post" selected="selected">In Posts</option>
      <option value="page">In Pages</option>
      <option value="pag">In Tags</option>
    </select>
    &lt;input type="submit" name="search" id="search" value="Search" /&gt;
  </p>
&lt;/form&gt;

View Selection Source [mozilla]
Code:
<p>  </p> &lt;input name="blog_search" id="blog_search" type="text"&gt;
  
  <p>
    <select name="search_area" id="search_area">
      <option value="post" selected="selected">In Posts</option>
      <option value="page">In Pages</option>

      <option value="pag">In Tags</option>
    </select>
    &lt;input name="search" id="search" value="Search" type="submit"&gt;
  </p>

#2
[eluser]LuckyFella73[/eluser]
As far as I know you can't nest a form into a form.
More information about allowed elements in forms:
http://www.w3.org/MarkUp/html3/forms.html

In your script you open the first form via form-helper,
then you open a second form within the first via plain HTML
and in the end you have one closing form-tag.

#3
[eluser]iainco[/eluser]
Why do you need 2 forms?

Code:
&lt;form action="blog/do_search" method="post" name="search" id="search"&gt;
  <p>
    &lt;input name="blog_search" id="blog_search" type="text"&gt;
  </p>
  <p>
    <select name="search_area" id="search_area">
      <option value="post" selected="selected">In Posts</option>
      <option value="page">In Pages</option>
      <option value="pag">In Tags</option>
    </select>
    &lt;input name="search_submit" id="search_submit" value="Search" type="submit"&gt;
  </p>
&lt;/form&gt;

Is the above code what you're trying to achieve?

Edit: You shouldn't give the submit field the same name and id as the form either.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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