Using variables with class='SaveBeforeNavigating
Maybe this is not possible, but I'd like to insert variables in the class definition so that the stat of the record referenced changes the color and text of button in the report.
The button [Edit DSR on Active Page] exists in a report on the user home page.
The user initiates editing of an incomplete record by hitting that button, editing it until they they hit [Save & Continue] which will increment the [Active Form] which is a page counter. User also decrement [Active Form] it if they hit the [Back] button.
When the user reaches form 4, they are there simply to review their work. If they hit [Save & Finish Later] they return to the home page --- That's where the scenario changes. I'm attempting to use fields to provide dynamic color values so when they see the record in the report on their home page it will be green instead of blue and black text instead of red. If possible I'd also change the text.
I made a copy of [Edit DSR on Active Page] and labeled it "Update DSR", then tried inserting the fields in the class statement like this:
"<a class='SaveBeforeNavigating' data-replaceRid=true style=\"text-decoration:none; background: [Background Color]; border-radius: 5px; color: [Text Color]; display: inline-block; padding: 5px 0px 5px 0px; width:138px; text-align: center; text-shadow: none; border: 2px solid #1b8b0a; font-size: 12px \"href='" & $URL & "'>Update DSR</a>"
For reference, The two formula text fields I used I inserted were as follows:
[background color] field 280, If([Active Form]=4,"1b8b0a","0863f5")
[text color] field 281, If([Active Form]=4,"ffffff","0a0a0a")
The results were unsuccessful (shown below) but I'm hoping that I'm not far off if this is something possible. If it had worked correctly only the top record shown would be different from the left column.
I appreciate any ideas you might provide.
I found that it was a combination of things. Your suggestion definitely made the difference for validating the color would appear based on the value, but to know it was changing I had to enter the hex code for each color in the two fields. It appears that for some reason the IF statements were not working in either the [text color] or [background color] fields, but I ended up trying an IF directly in the class statement and it worked:
"<a class='SaveBeforeNavigating' data-replaceRid=true style=\"text-decoration:none; background-color: #" &
If([Active Form] = 4, "1b8b0a", "0863f5") & "; border-radius: 5px; color: #" &
If([Active Form] = 4, "0a0a0a", "ffffff") & "; display: inline-block; padding: 5px 0px 5px 0px; width:138px; text-align: center; text-shadow: none; border: 2px solid #1b8b0a; font-size: 12px;\" href='" &
$URL & "'>" &
If([Active Form] = 4, "Review DSR", "Edit DSR") & "</a>"