Combo list focus on Click event- SAP UI5 - sapui5

I have a drop down control with first item as blank. But usually when the user will land on the page, there will be a value selected. User can click on the arrow in combobox to open the list and then choose the first option which is blank to clear the value. Issue is the list of options is too long and as the control always focusses/takes user to the option that was selected key, the user has to do some scrolling to reach the first option of blank.
Is there a way to always redirect the user to the blank option rather than the selected key option?
view.xml
<Label text="Reason"/>
<ComboBox items="{path:'modelName'>/results'}">
<items>
<core:Item text="{modelName>description}" key="{modelName>code}"/>
</items>
</ComboBox>

Related

How to find which controlls that can use the icon attribute? [SAPUI5]

I am looking for controlls that can use the icon attribute in order to display the sap-icon://accept. Till right now i have been using button in order to display icons, but as of right now, the border that does make an button, isn't fitting for the task, as such, i am looking for a new controll, that supports icon attribute as well as onPress/onClick Events.
<Button icon="sap-icon://accept"/> //displays the accept icon, however it does an border that makes an Button.
There is sap.ui.core.Icon class for displaying icons.
It also has press event you can use to click on that icon.
<core:Icon src="sap-icon://accept" color="#8875E7" press="handlePress" />

How can I keep the selection of a radio button on a form if a page reloads

Good day,
Part of a form I created consists of two groups of radio buttons that display specific text depending on which button is selected.
If a user clicks the submit button, but hasn't incorectly inputed something wrong (or has missed a field), the page reloads and displays an error at the top. Unfortunately, the radio button are resetted to no selection, so the user has to choose the options again in order to display the relevant text that needs to be amended.
How can I make it so the radio buttons do not reset once the page reloads (i.e. there selections will be saved)?
Note: I cannot stop the page from reloading after a user clicks submit; it's just the way the CMS is set up.
I've tried some scripts and searched Google, but I cannot seem to get anything to work due to the restrictions of the ancient CMS I'm working with.
<p id="submit">Please select one of the following:<strong class="required" style="color:red">(required)</strong></p><div>
// Here is one of the radio button groups that need to be saved. You'll notice that they are calling a script to display specific text when selected
<input type="radio" name="type" id="selection1" onclick="myOwnBehalf()" required> I am submitting this question on my on own behalf.<br/>
<input type="radio" name="type" id="selection2" onclick="onBehalfSomeone()" required> I am making this question on behalf of someone else.<br/>
<input type="radio" name="type" id="selection3" onclick="anon()" required> I would like to be anonymous.<br/>
....
The radio button selections are reset to blank once the page reloads because the users filled it out incorrectly.
Each time you navigate to a new page (or back to the same page) all of the JavaScript state is lost.
That means you need to pass the old state to the new page one way or another. Here are some ways of doing this:
These require using a scripting language like PHP for your pages:
PHP session (if you're using the PHP scripting language)
Navigate using form POST instead of a simple link
These could be done with just JavaScript
CGI variables in the URL you navigate to, for example mypage.php?choice1=3&choice2=5
Set a cookie then read it
HTML5 LocalStorage
(CGI variables: How to get the value from the GET parameters? )

How to always have a selected item in ion-select?

I have an ion-select which can select multiple options and i am setting the first option as selected initially using below code:
<ion-select interface="popover" class="note-select-list-documents"
[(ngModel)]="macroValues[ind]"
[multiple]="question.IsMultiSelect">
<ion-option *ngFor="let option of question.PickListOptions; let i = index"
[selected]="i==0"
[value]="option">{{option}}
</ion-option>
</ion-select>
Now, initially one option will remain selected but user can deselect that options. But, i want that there will always be one item selected. If user have option selected, then user can deselect one but when one item is selected, user can not deselect it.
Is there any control on ion-select to achieve this scenario?

How to prevent the tab key to start over from top when fill a form?

I am just wondering how to prevent the tab key to start over from top when using only the keyboard to fill a form such as a dropdown menu.
I am using bootstrap for this form and want due to usability reasons to jump to the next input field or dropdown menu instead of start over again from the top when tab on an item in a dropdown menu.
Try it on yourself:
Bootstrap form
you can add <element tabindex="1"> folllowed by <element tabindex="2">and it will follow the order you want. But at this time atleast on your form its working fine for me in chrome.

Ms access form: field order

can I somehow set in what order the text fields become active after pressing the "Tab" button?
I think it depends on when you added the field and not where it is in the form. So can I change this or I should add the fields in the order I want to switch them with the "Tab" button?
Thanks!
There are at least a couple of ways to change tab order.
With the form in design view, right click on an area of the form without a control. On the context menu that appears, click on Tab Order. A dialog will open that will allow you to change the tab order.
Another method is via the property sheet for each control. On the Other tab there is a property for Tab Order. Just set it to whatever you like.