search submission

shawn's Avatar

shawn

31 Oct, 2012 07:56 PM

I am kind of lost after getting my value and then submitting the form. I just want it basically to append the value to the end of a url. The value is the slug of the item. How would I do this? It is passing the slug, but as a url parameter (?as_values_077=ttaho%2C). I just want ttaho out of that.

Here is the page. You can type in any of the names listed.
http://cmfi.org/missionaries

The ending url I want to end up with is http://cmfi.org/wherewework/missionary/ttaho in the case of the one above. I know I may have to add an .htaccess rule to do that.

Thanks!

  1. 1 Posted by Jon on 06 Nov, 2012 07:41 AM

    Jon's Avatar

    You can use .htaccess to do that or you can get the value of the 'as_values_077' variable and redirect to the correct url.

  2. 2 Posted by shawn on 06 Nov, 2012 07:37 PM

    shawn's Avatar

    Thanks Jon,

    I am trying to figure out why there is a %2c at the end of my url. In my JSON feed, there is no comma or anything like that at the end of my slug. I have been going through the autosuggest.js file to see if there were an errant comma somewhere but have not had any luck.

    Example: http://cmfi.org/wherewework/missionary/?missionary=ttaho%2C

    Feed: http://cmfi.org/json

    Any suggestions?

  3. 3 Posted by Jon on 07 Nov, 2012 08:03 AM

    Jon's Avatar

    When you select an item in the autosuggest input, the value added to the hidden input has a comma at the end ('waiting' for the next item).

    Just make a substring:

    Javascript (for example)

    var data = item.substring(0, item.length - 1);
    
  4. 4 Posted by shawn on 07 Nov, 2012 03:45 PM

    shawn's Avatar

    Thanks Jon,
    Would that be added to the js file or the autoSuggest call?

  5. 5 Posted by Jon on 07 Nov, 2012 04:35 PM

    Jon's Avatar

    You can 'delete' the comma before or after submitting the form. The code I posted is just an example of 'deleting' the last comma in Javascript. You could also do it on your processing page (PHP, ASP, etc..).

  6. 6 Posted by shawn on 19 Nov, 2012 07:02 PM

    shawn's Avatar

    Hi Jon,

    I still have not figured this out. I am integrating this into a Wordpress site and PODS. I am using this as a search for some of the PODS content.

    Where is that comma added? And is it possible to just take it out?

  7. 7 Posted by Jon on 20 Nov, 2012 03:29 PM

    Jon's Avatar

    Hi,

    the comma is added to the hidden input field that the autosuggest plugin creates.
    You can take it out before you send the data to the processing page (1) or in the processing page (2). If you have an url like http://cmfi.org/wherewework/missionary/?missionary=ttaho%2C, you can take the %2C before you call that url, with javascript (the example I gave to you).

  8. 8 Posted by vihoottstoone on 10 Dec, 2012 01:32 PM

    vihoottstoone's Avatar
  9. 9 Posted by shawn on 16 Feb, 2013 02:31 AM

    shawn's Avatar

    This is just not making sense to me yet. (Obviously my strength it not js or jquery). Can you give me a fuller example? Do I need to submit the form using javascript? I am not quite understanding what would happen if the comma was not put in the hidden field (or if it can even be removed from the .js function). I only want to be able to submit one name at a time anyway.

    I know I am being kind of dense...

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