Welcome to the nuBuilder Forums!

Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.

Color of forms

Questions related to using nuBuilder Forte.
joecocs
Posts: 67
Joined: Wed Jul 04, 2018 4:11 pm
Location: France

Color of forms

Unread post by joecocs »

Hello,
In my app I have several sub-forms and for clarity I want to put a color to each form. ;)

I tried to assign a style in JScript to each form, but it does not work because I do not understand the syntax. :?

I am a newbee in JScript and Nubuilder !!!

Thanx for your help. :)
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: Color of forms

Unread post by toms »

Hi,

Here's an example:
To set a different background color, place this code in your mainform's JavaScript field:

Code: Select all

if (nuFormType() == 'edit') {
  $('#ID_of_your_subform').css("background-color", "red");
}

Replace ID_of_your_subform with the ID of your subform.
You do not have the required permissions to view the files attached to this post.
joecocs
Posts: 67
Joined: Wed Jul 04, 2018 4:11 pm
Location: France

Re: Color of forms

Unread post by joecocs »

toms wrote:Hi,

Here's an example:
To set a different background color, place this code in your mainform's JavaScript field:

Code: Select all

if (nuFormType() == 'edit') {
  $('#ID_of_your_subform').css("background-color", "red");
}
Replace ID_of_your_subform with the ID of your subform.
Thank you for your quick response,
that I arrived there,
but is there not a syntax to change the color of the current form or TAB ?
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: Color of forms

Unread post by toms »

Try this:

Code: Select all

  $('#nubody').css("background-color", "red");
Or:

Code: Select all

  $('#nuRECORD').css("background-color", "red");
admin
Site Admin
Posts: 2829
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 30 times

Re: Color of forms

Unread post by admin »

.
joecocs
Posts: 67
Joined: Wed Jul 04, 2018 4:11 pm
Location: France

Re: Color of forms

Unread post by joecocs »

Nice !

I use it
Just one detail for a subform in subform in form this is in normal color.?!?

If you have a solution for change its colour

Thank you
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: Color of forms

Unread post by toms »

Something like this:

Code: Select all

$(window.parent.document).find('#ID_OF_THE_SUBFORM_OBJECT').contents().find('#nuRECORD').css('background-color','red');
(Replace ID_OF_THE_SUBFORM_OBJECT with the subform object id)
admin
Site Admin
Posts: 2829
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 30 times

Re: Color of forms

Unread post by admin »

.
joecocs
Posts: 67
Joined: Wed Jul 04, 2018 4:11 pm
Location: France

Re: Color of forms

Unread post by joecocs »

Hello, thank you for your help.
toms wrote:Something like this:

Code: Select all

$(window.parent.document).find('#ID_OF_THE_SUBFORM_OBJECT').contents().find('#nuRECORD').css('background-color','red');
(Replace ID_OF_THE_SUBFORM_OBJECT with the subform object id)
I don't understand where i write this (in form, in sub-form or in record of sub-form ?)

see you soon
admin
Site Admin
Posts: 2829
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 30 times

Re: Color of forms

Unread post by admin »

joecocs,

If you place this inside the Javascript section of the main Edit Form...

Code: Select all

$(window.parent.document).find('#thesubform').contents().find("[id$='nuRECORD']").css('background-color','red');
it should work.
https://wiki.nubuilder.cloud/ ... Javascript

Steven
Post Reply