Nick7229476
Posts: 0
Joined: Mon Nov 17, 2014 9:27 am

Select box

I have successfully mapped column 1 of a database service table to a "select box" & when clicked, all the values in the table are
shown as options correctly.

Can anyone help with this? When a value is selected from the "select box", how can I get the associated value from column 2 mapped to a label on the same page?

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Select box

Hi Nick,

Not sure i've understand you correctly.

If you want to get selected in select component "view/value" pair, please follow the solution below:

1 Activate your select component.

2 Add "value change" event handler with action "Run javascript".

3 Populate it with following JS code:

precode

var currentValue = jQuery(this).val();

var currentOption = jQuery(this).find('option[value="' + currentValue + '"]');

var currentView = currentOption.text();

alert("currentValue = " + currentValue + ", currentView = " + currentView);

/code/pre

Details: http://prntscr.com/5esku2/direct

Regards.

Nick7229476
Posts: 0
Joined: Mon Nov 17, 2014 9:27 am

Select box

Yurii,
Thanks, when the select box is click it offers the category for the user to select.
When a selection is made (e.g Ysgol LLa...), I need the corresponding url (from column 2) to load in to the http:// box on the screen.
Thanks

Image

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Select box

Hi Nick,

Here is a solution for this goal:

1 Populate select with list service.

2 Create mapping as:

pre

Category - view.
url - value.

/pre

  1. On Select value change use following code:

    pre

    var currentValue = jQuery(this).val();

    //Note you should replace "urlInputName" with your input name.
    Apperyio("urlInputName").val(currentValue);

    /pre

    Regards.

Nick7229476
Posts: 0
Joined: Mon Nov 17, 2014 9:27 am

Select box

Yuri, thanks, almost there, but on click the label is changed, but adds the vaule of column 1, not column 2 (the url) from the database.

Image

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Select box

Hi Nick,

You have this problem because of you did not implement correct mapping to populate select.

Here is details: http://prntscr.com/5fszq0/direct

Regards

Nick7229476
Posts: 0
Joined: Mon Nov 17, 2014 9:27 am

Select box

Thanks for your help ( for being so patient).
Struggling here, I am now getting the url populated to both url & category box with this mapping.

Any suggestions?

Image

Nick7229476
Posts: 0
Joined: Mon Nov 17, 2014 9:27 am

Select box

Correct database grab here showing the problem.
Image

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Select box

Hi Nick,

I see you have wrong mapping again.

Please take a look on the screen shot to solve this problem:

http://prntscr.com/5gwgjv/direct

Regards.

Nick7229476
Posts: 0
Joined: Mon Nov 17, 2014 9:27 am

Select box

Thanks for persevering, mapping is correct but I'm still getting the url posted to the category field in the database... Image

Return to “Issues”