164 Posts
redback
8 years ago
3
Topic

Hello Sebloders,

i m looking for advice.

Goal: If somebody add in the frontend an article on list an search type, the form should refer to the current category of the List and Search Type.

Example: 

The form is capturing cars.
Categories are: VW, BMW, Mercedes.
One List and Search Type showing the cars selected by different menu items. Its made by the live value of the category.
To add a new car on the List and Search Type in the Frontend, there is a "button free" on the search Form. This works well.
Now i need that the submission on the menu item "VW" automatically insert the category VW in the form ... If somebody use the Button "Add Car" under the Menü Item "BMW", it should dynamically fill out the Form with category BMW and so on

----

Has anybody an idea how to achieve this?

Best Chris 

Get a Book for SEBLOD
1283 Posts
Bucklash
8 years ago
2
Level 1

Hi Chris

So I'm guessing then that

1

SD Live is not appropriate because page is a list not one piece of content.

2

Conditionals wouldn't apply here

3

Is custom javascript all that is left? I did this a while ago...

/* The field I wish to retrieve the data from */
$( "#cat_title" ).keyup(function(e) {
    /* Storing the value as a variable */
    $catTitleValue = $(this).val();
    /* The field I wish to set with the variable */
    $("#field_to_place_value").val($catTitleValue); 
    /* funky :) */
}); 

Is that what you mean?

Curious to know what solution you end up with

Bucklash

164 Posts
redback
8 years ago
1
Level 2

Hi Bucklash,

thanks for your idea, your nice script and your linked article. There is another way to achieve the goal pretty simple. A big thank you to Seblod user designbengel, who had the hint.

Well lets start:

1. You use the Plugin Button Free and put it on the List and Search Type (Search Form)

2. You have an second field on the Search Form as well published ... Field: cat_id - you  can set this to hidden.  
For example you have there an Live-Value from the menulink. Lets stick to the cars. There are menus-items with separate live values VW=01, BMW=02, Mercedes=03

3. Now you the setup of the Button Free: 

     - Edit Field and choose Link > Form
    - Click on the "+" behind the Form and go to custom variables
    - Put in custom variables: carcategory=$cck->getValue('cat_id');

     Now you getting an url with the your setup variable "carcategory" and with the Live-Value ... www.yourdomain.com/.../.../submit-car?carcategory=01

4. Next you grab the the value out of the URL on your form and put it as Live-Value into your field

     - Go to your Form (Site or Admin) and choose number 2 (Live Value) ... Example: field cat_id
    - Change default into Variable and configure it
    - Put in the field Variable "carcategory"

Now, when you submit a car via Button on the search form the category will be transferred automatically to the form

Best Chris

1283 Posts
Bucklash
8 years ago
0
Level 3

Hi Chris

Kudos to your repky.

Nice and appreciated, thumbs up!

Bucklash

Get a VIP membership