Page 1 of 2

Select box

Posted: Mon Dec 08, 2014 9:17 pm
by Nick7229476

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?


Select box

Posted: Tue Dec 09, 2014 3:46 am
by Yurii Orishchuk

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.


Select box

Posted: Tue Dec 09, 2014 10:46 pm
by Nick7229476

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


Select box

Posted: Wed Dec 10, 2014 10:26 pm
by Yurii Orishchuk

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.


Select box

Posted: Thu Dec 11, 2014 8:50 am
by Nick7229476

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


Select box

Posted: Thu Dec 11, 2014 11:20 pm
by Yurii Orishchuk

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


Select box

Posted: Fri Dec 12, 2014 11:47 am
by Nick7229476

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


Select box

Posted: Fri Dec 12, 2014 11:51 am
by Nick7229476

Correct database grab here showing the problem.
Image


Select box

Posted: Sun Dec 14, 2014 10:39 pm
by Yurii Orishchuk

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.


Select box

Posted: Mon Dec 15, 2014 3:15 pm
by Nick7229476

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