Posting user entered text using $.ajax, how to pass text content in the data property?
Date : March 29 2020, 07:55 AM
seems to work fine You would simply do data: { aT: articleText }. Then in your server-side script you can access that text as post variable aT...in PHP it would be: $_POST['aT']. jQuery converts { aT: articleText } to "aT=myTextContentWouldBeHere".
|
Display/disappear default text in TextField when user enters data/erase the text
Tag : java , By : brennen
Date : March 29 2020, 07:55 AM
like below fixes the issue What i am trying to do is , until the user enters data to a field for a example there is a field called "First Name". When the user selects the field "First Name" text disappears and the user can type their First Name. IF the user doesn't type anything, the text should display again in the text field.
|
Add image and text dynamically by user input(user is providing data) in Android Custom LIst View
Date : March 29 2020, 07:55 AM
hope this fix your issue Explanation:- I have a form in which user is providing his firstname and lastname. On click of submit button on the form containing firstname and lastname, this firstname and lastname will be displayed in the first row of list then second user will perform the same task and then that firstname and lastname of the second user will be displayed in the second row of the list. , You need to write code in a below way to achieve your target.... public class Restaurant extends Activity {
List<Restaurant> model=new ArrayList<Restaurant>();
RestaurantAdapter adapter=null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button save=(Button)findViewById(R.id.save);
save.setOnClickListener(onSave);
ListView list=(ListView)findViewById(R.id.restaurants);
adapter=new RestaurantAdapter();
list.setAdapter(adapter);
}
private View.OnClickListener onSave=new View.OnClickListener() {
public void onClick(View v) {
Restaurant r=new Restaurant();
EditText name=(EditText)findViewById(R.id.name);
EditText address=(EditText)findViewById(R.id.addr);
r.setName(name.getText().toString());
r.setAddress(address.getText().toString());
RadioGroup types=(RadioGroup)findViewById(R.id.types);
switch (types.getCheckedRadioButtonId()) {
case R.id.sit_down:
r.setType("sit_down");
break;
case R.id.take_out:
r.setType("take_out");
break;
case R.id.delivery:
r.setType("delivery");
break;
}
adapter.add(r);
}
};
class RestaurantAdapter extends ArrayAdapter<Restaurant> {
RestaurantAdapter() {
super(LunchList.this, R.layout.row, model);
}
public View getView(int position, View convertView,
ViewGroup parent) {
View row=convertView;
RestaurantHolder holder=null;
if (row==null) {
LayoutInflater inflater=getLayoutInflater();
row=inflater.inflate(R.layout.row, parent, false);
holder=new RestaurantHolder(row);
row.setTag(holder);
}
else {
holder=(RestaurantHolder)row.getTag();
}
holder.populateFrom(model.get(position));
return(row);
}
}
static class RestaurantHolder {
private TextView name=null;
private TextView address=null;
private ImageView icon=null;
RestaurantHolder(View row) {
name=(TextView)row.findViewById(R.id.title);
address=(TextView)row.findViewById(R.id.address);
icon=(ImageView)row.findViewById(R.id.icon);
}
void populateFrom(Restaurant r) {
name.setText(r.getName());
address.setText(r.getAddress());
if (r.getType().equals("sit_down")) {
icon.setImageResource(R.drawable.ball_red);
}
else if (r.getType().equals("take_out")) {
icon.setImageResource(R.drawable.ball_yellow);
}
else {
icon.setImageResource(R.drawable.ball_green);
}
}
}
https://github.com/commonsguy/cw-lunchlist/tree/master/05-FancyList/LunchList
|
How can I read the data paste in text area from user and apply the Jquery code on that text
Date : March 29 2020, 07:55 AM
|
How to save Text field (user input) data in a text file in Android app
Date : March 29 2020, 07:55 AM
|