201
Views
12
Comments
Autocomplete prompt text not showing
Question
I have implemented an autocomplete and want to change the default "Type or double-click for list" prompt text to "type postcode or suburb".  I've changed the Prompt property.  When the page is loaded my custom prompt text is momentarily shown but then overridden by the default text.

You can see it here https://advanceremovals.com.au
2011-09-30 16-44-42
João Fernandes
Hi Gavin,

I've made a quick test and cannot reproduce your problem. Are you using some kind kind of javascript to manipulate inputs?
If that's the case, maybe the javascript is interfering with the promp.
2022-11-12 11-28-30
Gonçalo Martins
Staff
Hi Gavin,

Did you check on your browser console if you're getting some javascript errors?
And inspecting the html element containing the prompt, did you saw the text you're expecting?

Kind Regards,
GM





2012-03-16 12-21-09
João Rosado
Staff
Hi Gavin,

The input prompt of some widgets was broken in 8.0.0.5. Latest versions should have no issues with it.
What version are you using?

Regards,
João Rosado
2013-02-27 02-39-44
Gavin Horne
The auto completes (2) are in a web block with no javascript etc.  There is an error on the home page containing the web block to do with jquery.min.map (below) but I've tested it on a page with nothing other than the web block and it still behaves the same.  

GET https://advanceremovals.thinknetwork.com.au/AdvanceRemovals/Blocks/JQueryGoodies/Javascript/jquery.min.map 404 (Not Found)

If I inspect the element (below), the placeholder text has been replaced.

<input name="wt2$wtPOSTCODE_SUBURB_FROM" type="text" maxlength="108" id="wt2_wtPOSTCODE_SUBURB_FROM" placeholder="Type or double-click for list" onkeydown="return OsEnterKey('wt2_wt20', arguments[0] || window.event)" style="width: 90%" class="os-internal-ui-autocomplete-input" autocomplete="off" role="textbox" aria-autocomplete="list" aria-haspopup="true">

I'm using 8.0.0.8 but I will upgrade to 8.0.0.12 and see if that fixes it, fingers crossed :)  If it doesn't help I'll try and create a 'clean' test project.

Thanks JF, GM & JR for your help so far.

Cheers,
Gavin
2013-01-31 21-55-49
André Alho
This is the code that sets the prompt in Richwidgets v8.0.0.12 AutoComplete WB

"<script type=""text/javascript"">
$(function() {var inpid='" + InputWidgetId + "';
var inputData=OsInputPrompt_GetInputData($('#'+inpid));
var prompt = (inputData || {}).prompt;
if(typeof(prompt)=='undefined'||prompt==''){
if ('ontouchstart' in document.documentElement) { //mobile phones
OsInputPrompt_Bootstrap(inpid, '" + "Type or tap for list" + "');}
else { OsInputPrompt_Bootstrap(inpid, '" + "Type or double-click for list" + "');}
}
});
</script>"

I think this code runs before the code that sets the SS prompt, with prevents last one from setting new prompt.

Just a guess
UserImage.jpg
sue B
I am using Outsystems Service studio 8.0.1.25 and i am having the same issue where I am unable to change the text.. any help will be much appreciated...
2019-07-08 11-04-35
Leonardo Fernandes
 
MVP
Hi Sue.
I have come across that same problem as well. I "solved" it by creating my own autocomplete as a forge component. I know, it's not a fix, but more of a rewrite.

It's usage is very different, so you would need to invest some time to learn the basics. But in a few projects that I've used it, it opened up a whole set of possibilities to enhance user experience. Make sure to give it a look!
UserImage.jpg
sue B
Hi Leonardo,

Thanks for the suggestion.. I am new to Outsystems as well (as you might have guessed) I will try creating my own Automcomplete based on the requirments or re-use(if that is ok?)

Thanks!!
2019-07-08 11-04-35
Leonardo Fernandes
 
MVP
Yes, the OutSystems forge components were made to be reused!
Don't reinvent the wheel.
2020-03-19 14-14-27
Pedro Gonçalves
Staff
Currently using 9.0.0.19 and this is still occurring.

Due to time constraints I haven't checked Leonardo Fernandes version, but decided to override the placeholder text instead, with the following code in the web screen's Javascript property:

/* Handler that renames the autocomplete prompt when the DOM gets loaded */
$( document ).ready(function() {
    setTimeout(function(){ reset_OsInputPrompt_Bootstrap_prompt(); }, 100);
});

/* Function to be called by HTTPRequestHandler.RunJavascript action which is called by the Search and Reset filter screen actions */
function reset_OsInputPrompt_Bootstrap_prompt()
{
    $('.AutoCompletePrompt').attr('placeholder', 'Isn't this a cool autocomplete prompt???');
}

AutoCompletePrompt class was assigned to the input text box so that the reset prompt function could work.

It's still not 100% fine because the default prompt still gets to be seen between the user clicks, but since its color is pretty dim it gets past the user's attention, i guess... any suggestions?
2016-04-21 20-09-55
J.
 
MVP
Is it fixed by now?
Or are we stuck still with the forge component?
Or pedro's fix?
2019-07-08 11-04-35
Leonardo Fernandes
 
MVP
C'mon! The forge component is awesome! :)

But, if you still want to fix this, you can paste the following code in your eSpace javascript:

OsInputPrompt_GetInputData = (function(orig) {
    return function(el) {
        var inputData = orig(el);
        inputData.prompt = inputData.prompt || el.attr("placeholder");
        return inputData;
    };
})(OsInputPrompt_GetInputData);
No other changes to your application are required.

EDIT: Note that it will have the same effect on the inputs with a date picker, since they also override the prompt text with a dummy text.
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.