Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
textarea
textarea
Hi
In my form I have severall textarea in the form and in a subform.
When I enlarge the textarea (drag right bottom corner), the field comes under the next field.
Is it possible to keep the selected field always on top?
In my form I have severall textarea in the form and in a subform.
When I enlarge the textarea (drag right bottom corner), the field comes under the next field.
Is it possible to keep the selected field always on top?
You do not have the required permissions to view the files attached to this post.
-
- nuBuilder Team
- Posts: 4307
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 448 times
- Contact:
Re: textarea
Using ResizeObserver you could determine the resized object and then set its zIndex to e.g. 999 so that it becomes the top-most element
Add this Javascript in the form's custom code field:
Add this Javascript in the form's custom code field:
Code: Select all
if(nuFormType() == 'edit') {
var myObserver = new ResizeObserver(entries => {
const [changed] = entries;
$('textarea').css('z-index', 1);
changed.target.style.zIndex = "999";
});
var boxes = document.querySelectorAll('textarea');
boxes.forEach(box => {
myObserver.observe(box);
});
}
Re: textarea
Kevin
This works fine when I enlarge the field, it comes over the other fields.
It would be nice if the field returns to it's original size if I click on an other field. Is that possible?
This works fine when I enlarge the field, it comes over the other fields.
It would be nice if the field returns to it's original size if I click on an other field. Is that possible?
-
- nuBuilder Team
- Posts: 4307
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 448 times
- Contact:
Re: textarea
Code: Select all
if (nuFormType() == 'edit') {
$("textarea").each(function() {
$(this).data('height', $(this).height()).data('width', $(this).width());
});
var myObserver = new ResizeObserver(entries => {
$('textarea').css('z-index', 1);
const [changed] = entries;
changed.target.style.zIndex = "999";
$("textarea").each(function() {
if (changed.target !== $(this)[0]) {
$(this).height($(this).data('height'));
$(this).width($(this).data('width'));
}
});
});
var boxes = document.querySelectorAll('textarea');
boxes.forEach(box => {
myObserver.observe(box);
});
}
Last edited by kev1n on Thu Oct 24, 2019 10:13 am, edited 1 time in total.
Re: textarea
Kevin
Thanks for your help. I think there's a problem with the second script. It doesn't work.
Johan
Thanks for your help. I think there's a problem with the second script. It doesn't work.
Johan
-
- nuBuilder Team
- Posts: 4307
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 448 times
- Contact:
Re: textarea
Well, it works fine here.
I created a test form under https://demo.nubuilder.com/
The form is called textarea. If you add a new record and then paste my code in the developer console (F12), you can see it in action if you resize textareas.
But it could of course be that the code causes problems with subforms.
I created a test form under https://demo.nubuilder.com/
The form is called textarea. If you add a new record and then paste my code in the developer console (F12), you can see it in action if you resize textareas.
But it could of course be that the code causes problems with subforms.
Re: textarea
Kevin
Strange,
In your demo it's just the same as in my site.
When I enlarge Textarea 000 it comes between textarea 001 and it doesn't resize.
Johan
Strange,
In your demo it's just the same as in my site.
When I enlarge Textarea 000 it comes between textarea 001 and it doesn't resize.
Johan
-
- nuBuilder Team
- Posts: 506
- Joined: Fri Dec 28, 2018 1:41 pm
- Location: Krakow, Poland
- Has thanked: 8 times
- Been thanked: 18 times
Re: textarea
just fyi,
I took the code sent by Kev1n and just copy/paste it to my application in Form JS and works properly.
So the previous window go back to its original size once you start to resize another one.
I took the code sent by Kev1n and just copy/paste it to my application in Form JS and works properly.
So the previous window go back to its original size once you start to resize another one.
If you like nuBuilder, please leave a review on SourceForge
-
- nuBuilder Team
- Posts: 4307
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 448 times
- Contact: