Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. $return = array();
  2. switch($_REQUEST['action']){
  3. case 'register':
  4.  
  5. $v = true;
  6. $fields = array('u_first_name', 'u_last_name');
  7. foreach($fields as $f)
  8. ${$f} = $_REQUEST[$f];
  9.  
  10. $image_file = $_FILES['profile_image'];
  11.  
  12. //validate, upload image and manipulate db
  13. }
  14.  
  15. submit_button.setOnClickListener(new OnClickListener() {
  16. @Override
  17. public void onClick(View v) {
  18.  
  19. Boolean f;
  20. Boolean i;
  21.  
  22. //Get All Fields
  23. Edi_First_Name = (EditText)findViewById(R.id.Edi_First_Name);
  24. Edi_Last_Name = (EditText)findViewById(R.id.Edi_Last_Name);
  25. image_preview = (ImageView)findViewById(R.id.Reg_Profile_Image_Preview);
  26.  
  27. //check if any fields are empty, if not proceed to api, else show errors
  28. f = Function.notEmpty("First Name", Edi_First_Name);
  29. f &= Function.notEmpty("Last Name", Edi_Last_Name);
  30.  
  31. //check if image has been set
  32. i = Function.imageNotSet(image_preview);
  33. f &= i;
  34.  
  35. if(f == true){
  36. //if everything is validated,talk to api.
  37.  
  38. String first_name, last_name, company_name, job_title, email, contact, address_one, address_two, town, county, postcode, country, account_email, rep_account_email, account_password, rep_account_password;
  39.  
  40. first_name = Function.getEditText(Edi_First_Name);
  41. last_name = Function.getEditText(Edi_Last_Name);
  42.  
  43. //pass parameters so that we can call the register api via FUNCTIONS.java
  44. Function.registerCall(first_name, last_name, "test_image");
  45. }
  46. else{
  47. Toast.makeText(getApplicationContext(), "Error.", Toast.LENGTH_SHORT).show();
  48. }
  49. }
  50. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement