text field in a dialog box on a BlackBerry - blackberry

I want to create an empty dialog box with a text field inside. When the user enters data inside the box he must be redirected to another screen. I want the Dialog box to come up without any statements but must include a textfield

That should be doable with a PopupScreen, EditField and maybe a ButtonField so the user can let you know he/she is done entering data.

Just create standard OK dialog and then add an EditField to it.
BasicEditField inputField = new BasicEditField();
Dialog d = new Dialog(Dialog.D_OK_CANCEL, "Enter your Username:", Dialog.OK, null, Dialog.DEFAULT_CLOSE);
d.add(inputField);
int i = d.doModal();
if (i == Dialog.OK) {
Dialog.inform("Your Username is : " + inputField.getText());
}
Here's a complete tutorial

Related

How to save a record in table on Ax Form in a button click event?

I am new to AX, and I am struggling with the basics.
My requirement is to save the record in a table from form controls on a button click event. What is the best approach?
Because I also see "Override" method "CreateRecord". If I go with "CreateRecord" method, then is it possible invoke the method in "Button Click Event"?
In form you need to add a Button, then expand, right click in methods, Override method and select Clicked.
Here put your code, For example:
void clicked()
{
TableExample TableExample;
;
TableExample.clear();//clear fields
TableExample.Field1 = "Your Value 1";
TableExample.Field2 = "Your Value 2";
TableExample.Field3 = "Your Value 3";
TableExample.Field4 = "Your Value 4";
TableExample.Insert();//Insert in table
info("Record create");//Display a message (Optional, only an example)
super();
}

How to hide spinner on the basis of text entered in edittext box?

M sorry for wrong English. I want to hide the spinner on the basis of text entered in the edit Text box and not on some click event. This means spinner hiding condition should be checked on the basis of Edit Text value.
Any kind of help will be appreciated.
I have Used TextWatcher class to have a check on the text that is being entered in the edittext. And then have used the method to check ds
private void checkFieldsForEmptyValues()
{
Spinner =(Spinner)findViewById(R.id.site_spinner1);
String s1 = edit1.getText().toString();
String s2 = edit2.getText().toString();
if(s1.equals("admin") && s2.equals("admin"))
{
spinner.setEnabled(false);
}
}

How to prevent dialog from closing automatically on click in blackberry

I am developing an application in which i create a Dialog with Edit Field and save/Cancel button, i use validation on edit field,i want that if user enter valid entry and click save then the dialog should close but now the problem is when user click on save without enter any text in edit field dialog closes automatically,i want to prevent it after entering valid entry dialog should close.
I give cancel button to discard dialog.
Please help..how to achieve this..........
mOKButton.setChangeListener(new FieldChangeListener() {
public void fieldChanged(Field f, int arg1) {
if(_editText.getText()=="")
{
// do nothing
}
else{
_editText.setText(items[getSelectedIndex()]);
close();
}
}
});

Custom List Field with Custom ObjectChoiceField in blackberry?

I am a new BB developer working on android simultaneously, I am preparing a project containing list and object choice fields in both the languages.
In blackberry, I have a list of 10 elements and on each element row I need to show an arrow button on click of that button a ObjectChoiceField will pops up.
Here, it is clear that the list and obejctchoice field both are custom.
I am very confused please let me know, how this can be achieved.
Thanx in advance..!:|
// customize ListField
How to customize a ListField in BlackBerry?
To get clicked item just add below function to code
protected boolean navigationClick(int status, int time) {
Field field = this.getLeafFieldWithFocus();
if(field instanceof ListField){
System.out.println("navigationClick Yes Yes you clicked list item ");
ListField listField = (ListField)field;
// this will give you clicked index.
int index = listField.getSelectedIndex();
// pop up your Object choice field here...
}
return true;
}

When box is checked make a drop down readonly or uneditable in Rails

I have a drop down box in ruby on rails that allows a date to be entered. And there is a box beside it to indicate that no date will be entered.
When this box is ticked it changes the default value of the date to nil. However the user can still enter a date on the drop down boxes.
When the box is ticked I want the drop down to be readonly or uneditable how can I do this?
EDIT
function BlankOutStartDates() {
if (document.getElementById("service_unknown_start_date").checked == true)
{
document.getElementById("service_start_date_1i").selectedIndex = 0;
document.getElementById("service_start_date_2i").selectedIndex = 0;
document.getElementById("service_start_date_3i").selectedIndex = 0;
}
}
I want to add the addition javascript to make the drop down box read only if the box is ticket
I would actually do this in jQuery. Suppose your checkbox has class "no-date", and your select boxes all of the class "date-select". Then you could do this:
jQuery(".no-date").change(function(){
//Check if the box is checked
if(this.is(':checked')){
jQuery(".date-select").attr("disabled", "true");
} else {
jQuery(".date-select").removeAttr("disabled");
}
});
You'll want to double check "this.is(':checked')" is correct, but I think that will work.
This uses the "disabled" parameter of select tags: http://www.w3schools.com/tags/tag_select.asp

Resources