Umbraco 7-Umbraco表单复选框始终为false

时间:2018-07-11 14:50:49

标签: umbraco umbraco7 umbraco-forms

在Umbraco 7.5.9 (和7.5.9)中,我遇到了以下问题:

保存我的表单时,复选框始终以False的形式发布 在Umbraco中查看记录时,值为False 检索字段值时,该值为False。 表UFRecords中的recorddata还显示了带有错误值的json复选框 数据库中的示例数据:

private DatabaseReference mUserDatabase;
private FirebaseUser mCurrentUser;


//Android Layout

private CircleImageView mDisplayImage;
private TextView mName;
private TextView mStatus;

private Button mStatusBtn;
private Button mImageBtn;

private ProgressDialog mProgressDialog;

private static final int GALLERY_PICK = 1;

private StorageReference mImageStorage;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings);

    mDisplayImage = (CircleImageView) findViewById(R.id.settings_image);
    mName = (TextView) findViewById(R.id.settings_name);
    mStatus = (TextView) findViewById(R.id.settings_status);

    mStatusBtn = (Button) findViewById(R.id.settings_status_btn);
    mImageBtn = (Button) findViewById(R.id.settings_image_btn);
    mImageStorage = FirebaseStorage.getInstance().getReference();

    mCurrentUser = FirebaseAuth.getInstance().getCurrentUser();

    String current_uid = mCurrentUser.getUid();

    mUserDatabase = FirebaseDatabase.getInstance().getReference().child("Users").child(current_uid);
    mUserDatabase.keepSynced(true);

    mUserDatabase.addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {

            String name = dataSnapshot.child("name").getValue().toString();
            String status = dataSnapshot.child("status").getValue().toString();
            String image = dataSnapshot.child("image").getValue().toString();

            mName.setText(name);
            mStatus.setText(status);

            if (!image.equals("default")) {
                Picasso.with(SettingsActivity.this).load(image).into(mDisplayImage);

            } else {
                Picasso.with(SettingsActivity.this).load(image).placeholder(R.drawable.goodgolden).into(mDisplayImage);
            }


        }

        @Override
        public void onCancelled(DatabaseError databaseError) {

        }
    });

    mStatusBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            String status_value = mStatus.getText().toString();

            Intent status_intent = new Intent(SettingsActivity.this, StatusActivity.class);
            status_intent.putExtra("status_value", status_value);
            startActivity(status_intent);

        }
    });

    mImageBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {


            Intent gallaryIntent = new Intent();
            gallaryIntent.setType("image/*");
            gallaryIntent.setAction(Intent.ACTION_GET_CONTENT);

            startActivityForResult(Intent.createChooser(gallaryIntent, "Select Image"), GALLERY_PICK);
            /*
            CropImage.activity()
                    .setGuidelines(CropImageView.Guidelines.ON)
                    .start(SettingsActivity.this);
            */

        }
    });

}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == GALLERY_PICK && resultCode == RESULT_OK) {

        String imageUri = data.getDataString();

        CropImage.activity(Uri.parse(imageUri))
                .setAspectRatio(1, 1)
                .start(this);

        // Toast.makeText(SettingsActivity.this, imageUri, Toast.LENGTH_SHORT).show();

    }

    if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
        CropImage.ActivityResult result = CropImage.getActivityResult(data);
        if (resultCode == RESULT_OK) {


            mProgressDialog = new ProgressDialog((SettingsActivity.this));
            mProgressDialog.setTitle("Uploading");
            mProgressDialog.setMessage("Pleas Stand By");
            mProgressDialog.setCanceledOnTouchOutside(false);
            mProgressDialog.show();

            Uri resultUri = result.getUri();

            String current_user_id = mCurrentUser.getUid();

            StorageReference filepath = mImageStorage.child("profile_images").child(current_user_id + (".jpeg"));
            filepath.putFile(resultUri).addOnCompleteListener(new OnCompleteListener<UploadTask.TaskSnapshot>() {
                @Override
                public void onComplete(@NonNull Task<UploadTask.TaskSnapshot> task) {

                    if (task.isSuccessful()) {

                        String download_url = task.getResult().getStorage().getDownloadUrl().toString();
                        // dont know if this solution will work at 6:15 video

                        mUserDatabase.child("image").setValue(download_url).addOnCompleteListener(new OnCompleteListener<Void>() {
                            @Override
                            public void onComplete(@NonNull Task<Void> task) {

                                if (task.isSuccessful()) {

                                    mProgressDialog.dismiss();
                                    Toast.makeText(SettingsActivity.this, "Succesful Upload", Toast.LENGTH_LONG).show();
                                }

                            }
                        });


                    } else {
                        Toast.makeText(SettingsActivity.this, "Error Up Loading", Toast.LENGTH_SHORT).show();
                        mProgressDialog.dismiss();
                    }

                }
            });

        } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
            Exception error = result.getError();
        }
    }
}


07-11 20:15:12.147 30329-30329/com.example.android.lapitchat E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.android.lapitchat, PID: 30329
java.lang.IllegalStateException: Center crop requires calling resize with positive width and height.
    at com.squareup.picasso.Request$Builder.build(Request.java:496)
    at com.squareup.picasso.RequestCreator.createRequest(RequestCreator.java:758)
    at com.squareup.picasso.RequestCreator.into(RequestCreator.java:709)
    at com.squareup.picasso.RequestCreator.into(RequestCreator.java:665)
    at com.example.android.lapitchat.SettingsActivity$1.onDataChange(SettingsActivity.java:84)
    at com.google.android.gms.internal.firebase_database.zzfc.zza(Unknown Source)
    at com.google.android.gms.internal.firebase_database.zzgx.zzdr(Unknown Source)
    at com.google.android.gms.internal.firebase_database.zzhd.run(Unknown Source)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6247)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)

喜欢听到可行的解决方案!

1 个答案:

答案 0 :(得分:0)

尝试升级到Umbraco Forms 4.4.7。在第二次尝试之后,我设法使其正常运行。同时运行由Tim helpt创建的软件包:

https://our.umbraco.com/forum/umbraco-pro/contour/60744-Entries-have-dissappeared#comment-206075

还原了我的引导程序标记后,新旧的Umbraco表单都可以正常工作。