Link to home
Start Free TrialLog in
Avatar of rgb192
rgb192Flag for United States of America

asked on

jquery editInPlace select_options shows repeats if I put the default value first (follow up question)

jquery editInPlace select_options shows repeats if I put the default value first


if $yesOrNo='yes' then
select_options=
yes
yes
no

if $yesOrNo='no' then
select_options=
no
yes
no



without doing
if $yesOrNo='yes'
selectOptions="no:no"
else
selectOptions="yes:yes"

is there a way to eliminate repeats



note: a callback function provided by expert Hielo will

https://www.experts-exchange.com/questions/27857043/jquery-editInPlace-select-options-shows-repeats-if-I-put-the-default-value-first.html


 not work in this example because the form is being processed on another page

                url: "packages.php",
                params: "a=renamepackage&pid=1",


this is the solution provided by Hielo
$savingText="saving....";
$selectOptions="yes,no";
        echo '<h3>Value:<span id="yesOrNo">'.$yesOrNo.'</span></h3>';
        echo '<script type="text/javascript">
                    $(document).ready(function(){
                        $("#yesOrNo").editInPlace({
                            "saving_text": "'.$savingText.'",
                            "field_type": "select",
                            "select_options": "'.$selectOptions.'"
                            ,"callback": function(element_id, selectedValue, originalText) { 
								return selectedValue;
							}
                        });
                    });
                </script>';

Open in new window





$savingText="saving....";
$selectOptions="yes:yes ,no:no";
        echo '<h3>Value:<span id="yesOrNo">'.$yesOrNo.'</span></h3>';
        echo '<script type="text/javascript">
                    $(document).ready(function(){
                        $("#yesOrNo").editInPlace({


                url: "packages.php",
                params: "a=renamepackage&pid=1",

                            saving_text: "'.$savingText.'",
                            field_type: "select",
                            select_options: "'.$selectOptions.'"
                        });
                    });
                </script>';

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Kyle Hamilton
Kyle Hamilton
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of hielo
hielo
Flag of Wallis and Futuna image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rgb192

ASKER

thanks

I have a follow up question

want user to be given option to change value to a new value

https://www.experts-exchange.com/questions/27858595/want-user-to-be-given-option-to-change-value-to-a-new-value.html