Vue Element UI - Default el-input-number to empty field instead of a number - forms

Creating a form with no values and would like the input field to default to empty for two reasons:
Want users to be able to see the placeholder text.
Having a default number means the users can ignore the field by default. (I know I can validate the field, but that is just a bad user experience.)
The problem:
el-input-number fields default to a number (0 or whatever the :min value is set to).
This covers up the placeholder text.
The users can click save with the default number still in place. (I will validate, but don't want users to have to submit a bad value to know what to do.)
Does anyone know how to make the input field have the default value be just empty?

just give it a default value of undefined
https://codepen.io/rugia/pen/bGEoWaB?editors=1010

Related

TCA configuration: Value of field should be copied to translated record

I am adding a field to the pages table (is a relation to a file) and would like the value of the field in the pages record to be copied to the translated record by default.
Currently, the copied field is empty (default value), which is probably a good idea in most cases.
I am thinking of something that behaves like l10n_mode = prefixLangTitle without the prefix.
Depending on the TYPO3 version this should be possible with one of the following behaviours for the inline field:
https://docs.typo3.org/typo3cms/TCAReference/7.6/Reference/Columns/Inline/Index.html#behaviour
https://docs.typo3.org/typo3cms/TCAReference/8.7/ColumnsConfig/Type/Inline.html#localizechildrenatparentlocalization
https://docs.typo3.org/typo3cms/TCAReference/latest/ColumnsConfig/Type/Inline.html#allowlanguagesynchronization
Sine the localizeChildrenWithParentLocalization feature is broken with pages and pages_language_overlay though, I guess the only working versions would be CMS 8 or 9 with properly configured language synchronization.
https://forge.typo3.org/issues/78743
Use
['behaviour']['allowLanguageSynchronization'] => true
if the translated record will use the value from the default field by
default (will effectively be copied), but it should be possible to change
this later.
See pages.author as example.
When "Custom value" is selected, the value can be overridden.
Alternativively, use
l10n_mode = exclude
if the field should always have the value of the default language and you
should not be able to change it in the translated record.

Remove "empty" selection from dropdown list box

When creating a form in Orbeon Form Builder, you can define a list of values for a dropdown list box.
When running the form in form runner, is it possible to remove the "[Select...]" value from this dropdown list box?
I would like to restrict the possible values only to the given ones and restricting the user from selecting an "[Select...]" value when filling in the form. I hope you understand what I mean :)
Here is a screenshot
It's not possible without changes to Orbeon Forms to remove the empty option.
The best way to achieve what you want is to make the field required. When that's the case, the user will have to select a value or validation won't pass.
(The rationale for adding/keeping an empty option at the top is to force the user to make a selection. Otherwise it is possible that users might not even look at the option selected by default, and involuntarily select an incorrect option.)

Parsley.js - Re-validate a field after selecting an auto-complete value or drag-and-drop

After parsley validation, an error message may be displayed near a field.
If the user types a corrected value, the field is automatically re-validated, the message will disappear, and the field will be marked with success.
However, if a valid value is then entered by either i) selecting from the field's "auto-complete" dropdown OR ii) by dragging-and-dropping into the field, this will not invoke the re-validation, and the error message remains even though the field now has a valid value.
Example...
Q: How to force fields to re-validate upon selecting value from the browser's auto-complete dropdown/drag-and-drop?
(I realise you can specify no auto-complete on fields, but this may not always be desirable, and doesn't solve the drag-and-drop issue.)
In autofill function add this code to validate the autofill fields again:
function autofill_function_name(){
your code;
$("#autofill_field_name").parsley().validate();
}
In my case, I use bootstrapValidator for validation.
Then, you have to revalidate the field after fetching data
$('yourForm).bootstrapValidator('revalidateField', 'inputName');

Live search combo in Ext JS 4.2.2

I'm trying to implement a live search combo. It suppose to work like this:
When I enter a character into the combo field I read the current value and send it as a parameter to the store's url. In the backend the parameter is used to return any value from the database that contains it, so the store behind the combo gets filled only with those filtered values.
As I continue to enter characters into the combo, the parameter should be updated and sent again to the backend and so on, getting like this a smaller and smaller store.
I tryied to achieve this behaviour using the combo's event keypress, even keyup, but the problem is it's impossible for me to get access to the current value from the combo field.
For example, when I entered the "for" string into the combo, how can I obtain this value using the combo object? comboName.getValue() doesn't work, it returns nothing "".
I already saw the live combo example here: http://docs.sencha.com/extjs/4.2.2/#!/example/form/forum-search.html but doesnt help me at all.
So my big question is: how do i get the current value while still editing the combo's field?
Any help would be appreciated, thanks.
You should be able to use
comboName.getValue();
or
comboName.getRawValue();
Where comboName is your combo box. Are neither working- I note in your post you state getValues() which is an improper method. You may want to also check whether when you're referring to your combo box object, that the reference is actually correct. The first argument from the key events is actually the object itself, so you should be able to do, e.g.
listeners:{
keyup:function(comboBox){
var value = comboBox.getValue() || comboBox.getRawValue();
console.log(value);
}
}
Swapping you the value getting method as appropriate.
I found that the combo already has a quick search behaviour, I just have to set queryMode on 'remote' and some other small configurations. More details here:
Ext Js 4.2.2 combobox queryMode

Drupal 7 - Hide certain form fields of a content edit form depending on the content data

In Drupal 7, is there a way to change the standard edit form for a content type based on a certain content?
For example:
I have a content type with a checkbox...once it it checked and the form is saved, I do not want this checkbox to be visible anymore...therefore based on the checkboxes value in the Database I want to hide form fields when showing the form.
I am building a small specific project site, where a company wants to add projects, and their customers are supposed to follow certain steps (upload some content, provide information etc.), and also should be able to check off certain requirements, and once these are checked off, they should not be visible/editable to them.
Also the displayed form fields should depend on an user's role, and then FURTHER be limited depending on the content's database entries.
Is there a module, which could achieve this behaviour? "rules" and "field/permissions" come close to what I need, but are not sufficient. Or did I just miss the option to change a form field's accessibility based on conditions?
What I need is some place to define a logic like "IF (VALUEOF(CHECKBOX_1) == TRUE) THEN DO_NOT_SHOW(CHECKBOX_1)"
hook_form_alter is the way to do this, as explained by Mihaela, but what options do you have inside that function?
If you want just to disable field (it will be visible, but user can't change it) you can do it like this:
$form['field_myfield']['#disabled'] = TRUE;
And if you want it to be hidden, but to keep value it has before editing the way to do that is:
$form['field_myfield']['#access'] = FALSE;
I.e. hiding it (somewhere I saw someone suggesting that):
hide($form['field_myfield']);
really hides the field, but after that, when form is saved this field has empty value, validation fails, etc, so that's not a good way to do this. Hiding makes sense only if you want to print separately that field later, at some other place.
function your_module_form_alter(&$form, &$form_state, $form_id){
switch($form_id) {
case 'nameOfTheNode_node_form':
//your code here. check the value from from_state.
break;
}
}
In this case, I use module Conditional Fields https://www.drupal.org/project/conditional_fields
For example: If my Dependees field has a value, Dependent field can be visible/invisible, enabled/disabled, required/optional, checked/unchecked