after you select, how do you submit?

del boy's Avatar

del boy

29 Jun, 2011 04:08 PM

ok so my search box looks great, and autosuggests stuff, with json variables 'name' and 'value' being passed :-D

however when i hit submit, i get redirected to my error page, because my input field is empty!
so i thought, instead of the user clicking search, i could use selectionAdded: function(data){}
to redirect to the page

but how on earth do i get the value?

if i alert(data) it appears to be the box with the little x ?!

  1. 1 Posted by Christopher Ray... on 13 Aug, 2012 10:29 PM

    Christopher Raymond's Avatar

    I'm struggling with this as well. I want it to automatically submit as soon as one value is clicked and I cannot seem to figure that out.

    However, I did figure out how to get the data that you are after ...

    resultClick:function(data) { console.log(data.attributes.name); $(this).val(data.attributes.name);

    Where name is the particular JSON variable that I'm after.

    I do NOT have the $(this).val portion working. I have been trying to place the clicked val into the input field, but that doesn't seem to work or I'm just too tired from fighting with it all day. Anyone who can help me figure out how to have the darn thing auto-submit the form when a suggestion is clicked, please let me know!

  2. 2 Posted by Christopher Ray... on 13 Aug, 2012 11:07 PM

    Christopher Raymond's Avatar

    Okay, I figured it out. And as usual, I figured it out only after polluting the Interwebs with my question ;-)

    resultClick:function(data) { console.log(data.attributes.name); $("input[type=search]").val(data.attributes.name); $(this).submit(); }

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac