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

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

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

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

</ 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');

<p>
&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
#2

[eluser]sirfilip[/eluser]
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
$(document).ready(function(){
$('.autocompleatable').onsomeevent(function() {
// add autocomplete behavior....
});
});
#3

[eluser]InsiteFX[/eluser]
Not only that but he has a space in his ending script tag!

InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB