Change In Line Style of Input

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

tom.smith
Ebase User
Posts: 24
Joined: Thu May 09, 2013 2:54 pm

Change In Line Style of Input

#1

Postby tom.smith » Thu Apr 10, 2014 9:46 am

Hi

I've got a form that highlights input fields by adding an in-line style to the input in the form of a background colour:

Code: Select all

controls.ADDRESS1.setEditorStyle("background-color:#FEB3B3;");
This code is executed in a before-load event on the page.


What I would like to do, but can't seem to, is to clear the background colour on a button click event. I've tried the following (individually):

Code: Select all

controls.ADDRESS1.setEditorStyle("background-color:transparent;");
controls.ADDRESS1.setEditorStyle("background-color:initial;");
controls.ADDRESS1.setEditorStyle("background-color:#FFFFFF;");
The code is executed, but the background remains. When I inspect the element on the page I can still see the initial inline background colour being applied.


Any help in clearing this applied background would be appreciated.

Thanks

Tom
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#2

Postby Jon » Thu Apr 10, 2014 11:06 am

Tom,

This will clear the style:

Code: Select all

controls.ADDRESS1.setEditorStyle(null);
For info, you can also do this:

Code: Select all

controls.ADDRESS1.editorInputProperties.backgroundColor = "#FEB3B3";
controls.ADDRESS1.editorInputProperties.backgroundColor = null;
Regards
Jon
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#3

Postby Jon » Thu Apr 10, 2014 11:50 am

Not sure if this is relevant but you can use the Error Focus Style to automatically highlight any fields that fail validation or have an error message. You configure this in form properties, presentation tab or in a presentation template, click on "Form".
0 x

tom.smith
Ebase User
Posts: 24
Joined: Thu May 09, 2013 2:54 pm

#4

Postby tom.smith » Thu Apr 10, 2014 1:13 pm

Hi Jon

Thanks for your posts. The first one worked just as I wanted - no idea why I overlooked the use of null whilst trying everything else, but thanks.

I'm passing values into the form and populating fields, and highlighting ones that the user needs to double-check, so there isn't any validation occurring. Error Focus Style isn't particularly relevant to my specific application here, but might be for another part I'm yet to design. I'll bear it in mind.

Thanks

Tom
0 x


Who is online

Users browsing this forum: No registered users and 4 guests