Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can i remove Select / Radio / Checkbox Value field and set Default value as per Text #1336

Open
raviozainfo opened this issue Oct 14, 2022 · 1 comment

Comments

@raviozainfo
Copy link

Description:

Hi, I want to remove Value from Select / Checkbox / Radio in option and need to set value as per Its Text.
Or its ok if what i am typing in text fields will auto set in Value.

Environment Details:

  • formBuilder Version:
  • Browser:
  • OS:

Expected Behavior

image

Actual Behavior

Steps to Reproduce

Screenshot - (optional)

@lucasnetau
Copy link
Collaborator

Not directly in formBuilder but you could try the following

The options are wrapped by

Add styles to hide the value and expand the label

.form-wrap.form-builder .frmb input.option-label.option-attr {
    width: calc(89% - 17px) !important;
}
.form-wrap.form-builder .frmb input.option-value.option-attr {
    display: none;
}

then hook into the input event to update the value field when the label field is changed

$('#fb-editor').on('input','.form-wrap.form-builder .frmb input.option-label.option-attr', (event) => {
    $(event.target).siblings('.option-value').val($(event.target).val());
});

NOTE: I haven't tested this in practice, it should work but code will need to be double checked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants