Welcome Guest, Not a member yet? Register   Sign In
javascript variable to form from different views

as a step javascript variable to a form to record in the db
this is the javascript
### my first view
id="categoria" NAME="category" /> &lt;input type="text"
var category = new Array (

"tier one"
"tier two"
"lsita three, "

new AutoSuggest (document.getElementById ('category '), category);
&lt;/ script>

</ p>

&lt;/ form&gt;

&lt;/ body&gt;
&lt;/ html&gt;

###my second view

&lt;? php
$ today = date ("Y / m / j");
$ hidden = array ('fecha_registro' => $ today
'category' => 'category',
'status' => 'limited');
Form_Open echo ('login / create_member','',$ hidden);
form_label echo ('category ');
include ("completado.php");

Form_Open echo ('login / create_member','',$ hidden);
/ / echo Form_Open ('login / create_member');

&lt;? form_submit php echo ('submit ', 'new');?&gt;
&lt;? php echo form_close ();?&gt;
the form is set as the word category category category not as a string coming from the page containing the javascript,, I can give any recommendation or to take the value form that attempted to pass from the opposite page, thanks in advance

I believe that the js cant find the document you are looking for cause it should be
called after the document has been loaded in order to perform getDocumentById successfully. Try to place the javascript functions into an window or document.onload = function() { here };

Anyway the much better solution will be using an unobtrusive javascript ex. try adding a autocompleatable class to the input field you try to auto complete and target that field with the js.
&lt;input type="text" class="normal css classes and autocompletable" value="whatever" /&gt;

using jquery for ex
$('.autocompleatable').onsomeevent(function() {
// add autocomplete behavior....

Not only that but he has a space in his ending script tag!


Theme © iAndrew 2016 - Forum software by © MyBB