Question

I have a preference set in adfmf-feature and in amx page I get it using <amx:inputText label="url" id="it1" value="#{preferenceScope.feature.adf.mobile.sample.ProfilePage.showProfileImage.showImage}"/>.

But if i use the same format for HTML <input type="username" name="xyz" id="user" value= "#{preferenceScope.feature.adf.mobile.sample.username}" /> i am not able to get the result. i get #{preferenceScope.feature.adf.mobile.sample.username} itself as the output in the text box! The values here are just for identification purpose. They match the their respective id's in my application

Should it be written in Javascript side? or is there any other way to get the value and set?

Thank you

Was it helpful?

OTHER TIPS

in order to get the preference value and insert it into a field in an HTML page you need to use the javascript api adf.mf.el.getValue(expresion, onSuccess, onFail)

so in your case you can do the below

<script type="text/javascript">
function getPrefVal(){
      adf.mf.el.getValue("#{preferenceScope.feature.adf.mobile.sample.ProfilePage.showProfileImage.showImage}",
      onSucess,onFail);
}
function onSucess(req, res) {
    //alert( res[0]['value']);
    $("#user").val(res[0]['value']);
} 
function onFail (req, res) {
          alert("Get Value Failed :" + adf.mf.util.stringify(res));
}
//use the below code instead of $(document).ready() or deviceready 
document.addEventListener("showpagecomplete", getPrefVal, false);
</script>

<input type="username" name="xyz" id="user" value= "" />

HTML doesn't know how to resolve an EL expression - see if you have a Javascript API that lets you access the preferences.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top