Field Array push not able to focus next field? - redux-form

I'd like to know if is possible to focus the next field in FieldArray after a fields.push('').
In my case, all time that a user put an empty space on an input a create a new on field array and want that this new one receives the focus.

Your next field have is going to have name, so you can use the Focus action.
Focus Action

Related

Position a form on a form in vb6

I need to open a second form and position it in a particular location on the first form opened.
Explain: I added a panel to the original form and as I was putting controls on it, I got a message that I could not add any more controls. So...
There is an existing panel that I need to cover up with a second form and have it remain covered even if the original form is dragged about the screen. The second form will cover it, but I need to know how to position it in reference to the first form.
The only references I can find are how to position it on the screen, not another form.
There's certainly no easy way to do that (a form can't host another form). The limit you encountered was the max number of named controls you can have on a form (254, see https://msdn.microsoft.com/en-us/library/aa240865(v=VS.60).aspx).
However, a control array only counts once to that limit. So instead of adding a new control (for instance text boxes) for every input field, add them as new elements of a text box array. The difference in code is that you'll reference the text boxes by index instead of unique name (you can use constants as index parameters to identify the different input fields, such as name, address, etc).

How do I have Primefaces focus not move to first field and yet show validation

I want to use <p:focus> in two ways:
1. Move to the input field if that field fails validation, i.e. is required
2. If on a page that has an input field that is visible when the page loads then move to that field. But if the page has a lot of introduction text and the input field is way down the page then don't move to the field as the user has to then scroll up to read the start of the page.
How can I have both cases handled? It seems that if I have <p:focus> I cannot avoid the page scrolling automatically way down the page if the first input field is there but I also want to move to the required field if a value has not been given.
Thanks
First, don't use the attribut for to select the default focused element.
Second, you only have to update your p:focus, and it will automatically select the first field where error occured.
For 1: See the answer above or http://www.primefaces.org/showcase/ui/misc/focus.xhtml
For 2: The only solution I know of that can achieve this is to not use the <p:focus/> and implement your own focus code (not to difficult). Detect the position of the first input and if it is far down, don't 'focus' it.

After a form is filled once, I blank out the form before filling it the next time (new conversation), but the borders remain red

I have used webshims for html5 form validation in a single page app with multiple pagelets(divs). The forms are not submitted but local javascript is invoked after each conversation and collected data is posted .
Next I iterate over all the fields and reset the values.
Then I take the new user back to the first pagelet having first form for the new conversation. This time even after filling the correct values the border does not turn green.
Note:
However when we select the field and click outside the field without filling it. and then after filling the correct data border turns green.
However when we tried to achieve it programmatically iterating over each field resetting it and using javascript focus method, that did not do the trick.
I am sure I must be missing some thing. would be able to point out what.
Regards
Barman
I'm not sure, what you want to achieve. I would need to see some code. If you change the value programmatically you can update the validation ui with the event refreshvalidityui on the form field. If you want to reset the ui, you can either trigger a reset event on the form or resetvalidityui on the form field
$('input').val('foo').trigger('refreshvalidityui');
or
$('input').val('foo').trigger('resetvalidityui');
or
$('form').trigger('reset');
Please let me know, if this helps.

Validate text in TextField

I have in my program a textfield which represents a fileName from a model object using bindings. I want that this textField could be used to enter a new fileName and after user presses Enter it should send the message to my model object that value of fileName has changed in my textField, then inside my model object the method for checking if such filename can be used is called. And if it returns true, then it should apply new value to my model object, if not, then value in my textField should undo to initial value.
Does somebody know how it could be implemented? I can validate my value but I can't make my textField refresh to initial value. As for both changing the model object value, and texField refreshing should be used single method which is KVC compliant I don't know how to implement such behaviour.
Any help would be very appreciated.
This doesn't sound like a good UX to me; as a user, I would be upset to find that if I made a simple typo in a text field, it completely erased what I had just input. It would be much better to show a message indicating what was wrong and how the user can fix it. Nonetheless...
I think you should set up a text field delegate. Have the delegate keep a variable holding the last valid string that was input. Then in textFieldShouldEndEditing:, do your check for validity, and if the check does not pass, set the text field's value to that variable and return NO. If it does pass, change the variable to hold the new valid string and return YES.

Ajax Autocomplete field: display one value, but use another?

I've got an autocompleter in a CakePHP app that provides a dropdown list of neighborhoods to attach to a place. I'm pulling from a table 'neighborhoods' with name and id fields. I want the user to see the name of the neighborhood, and I want the app to see the id of the neighborhood and insert it into the places table. How can I make this happen?
Another way of doing this would be to storing the id. Then when a user presses submit you replace the input field's value with your stored value.
assign the correct (hidden) value to a hidden input field
This type of functionality is normally achieved with a combobox, which is like an autocomplete, with an underlying select elememt, see here

Resources