Hey Yogesh,

          You may want to also look at how you're referencing the
form.  Usually document.forms is a numerical array, not an
associative.  I'd recommend using an ID on the form object and then
grab it
 via $(form_id)...

document.forms['searchcustomerform'].submit();
vs
$("searchcustomerform").submit();

Cheers,
          Matt

On Oct 12, 3:02 pm, Yogesh Agashe <[email protected]> wrote:
> Hello,
> I am glad to say that I found the root of the problem. I had a button named 
> submit and this was causing the problem.
> Thanks so much Matt for pointing out the function definition error.
> As Christo notes here: 
> (http://www.spiration.co.uk/post/1232/Submit%20is%20not%20a%20function)
> This means you have a function trying to call the form's submit() method, but 
> you also have a button which is called submit(). This causes a conflict in 
> javascript, because the submit method is already bound to that button.
> To solve the problem, simply change the name of the button so that name="moo" 
> (or something). Your submit() call in your javascript function/method will 
> now work.
> Sincerely,
> Yogesh
> Yogesh Agashe wrote:Thanks for pointing out this error Matt. I should have 
> noticed this.
> But even after defining the function earlier, form submit doesn't work :(
> Sorry.
> Sincerely,
> Yogesh
> Matt Foster wrote:You've defined your function after you reference it... It 
> needs to be created first then it can be referenced. function 
> getSelectedId(text, li) { $('class_id').value=li.id; 
> document.forms['searchcustomerform'].submit(); } new 
> Ajax.Autocompleter("search","hint","server_class.php", {afterUpdateElement : 
> getSelectedId, minChars:1}); --http://positionabsolute.netOn Oct 8, 10:45 pm, 
> Yogesh Agashe<[email protected]>wrote:Hello, Thanks for the reply. I 
> tried doing that but it didn't work for me.If you point out the mistake in 
> following code, it will be great.Thanks again.<script type="text/javascript"> 
>     new Ajax.Autocompleter("search","hint","server_class.php", 
> {afterUpdateElement : getSelectedId, minChars:1});         function 
> getSelectedId(text, li) {             $('class_id').value=li.id;             
> document.forms['searchcustomerform'].submit();         } </script>Thanks, 
> Yogesh Matt Foster 
> wrote:http://wiki.github.com/madrobby/scriptaculous/ajax-autocompleterafterUpdateElementfunction...
>  you receive an input object and some element that was representing the 
> field. At this point you could execute form.submit.. 
> --http://positionabsolute.netOn Oct 7, 11:19 am, 
> Yogesh<[email protected]>wrote:Hello, I am using Ajax.autocompleter in 
> one of my forms. I am calling a custom function getSelectedId after update 
> element to get an ID of the selected list item. I need a functionality such 
> that form should get submitted whenever : 1) a user clicks a item using mouse 
> from the autosuggest list. 2) Whenever user presses enter key while a list 
> item is selected. (This I have achieved through a hack as shown in code 
> below. I call .submit() after getSele ctedId function) I don't know how to 
> submit the form on mouse click. Any help on this issue will be really helpful 
> to me. <script type="text/javascript">     new 
> Ajax.Autocompleter("search","hint","server_class.php", {afterUpdateElement : 
> getSelectedId, minChars:1});         function getSelectedId(text, li) {       
>       $('class_id').value=li.id;             
> document.forms['searchcustomerform'].submit();         } </script> Thank you. 
> Sincerely, Yogesh
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to