Hi All,
what is the best way to copy the value of a textarea field (textarea1) to another textarea field (textarea2) on the same form after textarea1 was changed?
Is there any simple solution available?
Thanks in advance and best regards,
Oli
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.
Copy field to another Field after Edit
-
- nuBuilder Team
- Posts: 4304
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: Copy field to another Field after Edit
Hi Oli,
Add a Custom Event onchange to your first Textarea object and call:
Add a Custom Event onchange to your first Textarea object and call:
Code: Select all
$('#other_text_area_id').val($(this).val()).change();
You do not have the required permissions to view the files attached to this post.
Re: Copy field to another Field after Edit
Additionally I tried to set a button to hidden if a specific value of a select field was choosen.
This is was I added to the select object and if the value is "in Planung" the Button should not be visible anymore.
But I guess I still have some errors in the code and I couldn't find an example how to get the value for a specific SELECT object and use it in an IF statement.
BR and thanks in advance, Oli
This is was I added to the select object and if the value is "in Planung" the Button should not be visible anymore.
But I guess I still have some errors in the code and I couldn't find an example how to get the value for a specific SELECT object and use it in an IF statement.
BR and thanks in advance, Oli
You do not have the required permissions to view the files attached to this post.
-
- nuBuilder Team
- Posts: 4304
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: Copy field to another Field after Edit
Try this:
If the text and values are different, you need to retrieve the text like this:
Code: Select all
function stringsAreEqual(a, b) {
var a = escape(a).replace(/%20/g, '').replace(/%A0/g, '');
var b = escape(b).replace(/%20/g, '').replace(/%A0/g, '');
return a == b;
}
nuShow('run_angebot_print', ! stringsAreEqual(this.value, 'in Planung') );
Code: Select all
$("#your_select_id option:selected").text();
Re: Copy field to another Field after Edit
Since I have to check various status values and the button should be hidden after the form was accessed it would be easier to hide the button with PHP.
Is there a way to conditionally hide or show objects with PHP as well?
Is there a way to conditionally hide or show objects with PHP as well?
-
- nuBuilder Team
- Posts: 4304
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: Copy field to another Field after Edit
You will have to use JavaScript. But you could prepare it in BE and run in with nuAddJavascript