Fake a Mandatory Label?

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
PointsWell
Posts: 1460
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Fake a Mandatory Label?

Post by PointsWell »

Is there a way to alter the CSS of a label based on a rule?

Fields that AIM has designated as mandatory have this:

Code: Select all

<img class="aw-req-field" height="7" width="7" src="aware_kendo/resources/images/ast.gif">
class applied to them.

Is there a way to inject this class to fields that are not mandatory, ideally based on a rule or (less desirably) based on a script?

If yes, can it be done dynamically as you go through a form (i.e. if a field, or fields, value changes show the flag).
customaware
Posts: 2407
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Re: Fake a Mandatory Label?

Post by customaware »

It can be done injecting an Attribute name as part of the Class Name, hence using a different Class based on the Attribute value.

ie.

<img class="aw-req-field myclass_{myattrvalue}" height="7" width="7" src="aware_kendo/resources/images/ast.gif">
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
PointsWell
Posts: 1460
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Fake a Mandatory Label?

Post by PointsWell »

Thanks Mark,

I'm not sure I understand.

I was hoping that there was a way to manipulate the css value for a field along the lines of what is discussed here and here

What I am trying to achieve is a Render script that finds the value of a field, checks it's value and then inserts the class type into the required field's label.

Having spent the day researching this I think I am "onto plums" as my granny would have told me (translation: you are sweet out of luck)
customaware
Posts: 2407
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Re: Fake a Mandatory Label?

Post by customaware »

Not sure if this is what you mean but by way of a more detailed explanation.....

Imagine you have the following in your custom CSS file.....

.solution_SELECTED{
text-align: center;
text-transform: uppercase;
background-color: #b2fb98;
font-weight: bold;

}
.solution_APPROVED{
text-align: center;
text-transform: uppercase;
background-color: #b2fb98;
font-weight: bold;

}

.solution_{
text-align: center;
text-transform: uppercase;
font-weight: bold;

}

Now this is some custom html on a form. In particular, this is a Custom View on a Form.
Have a look at the line that has {StatusSelected} and the following {StatusApproved}.

If I have for example an attribute in the BO called StatusSelected and the values for that can be.... SELECTED or Null ,then the value in the DB will determine the css class that is used for that element.

<div class="aw-data-item" >
<div class="aw-custom-line" >
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<th class="th_solution_solution">Solution</th>
<th class="th_solution_price">Price</th>
<th class="th_solution_unit">Unit</th>
<th class="th_selected">Employee</th>
<th class="th_approved">Approver</th>
</tr>
<tbody>
<tr>
<td class="solution_text" rowspan="5">{SolutionText}</td>
<td class="solution_price">{SolutionPrice}</td>
<td class="solution_unit">{DefaultCurrency}</td>
<td class="solution_{StatusSelected}" rowspan="5">{StatusSelected}</td>
<td class="solution_{StatusApproved}" rowspan="5">{StatusApproved}</td>
</tr>
<tr>
<td class="solution_price">{PrimaryPrice}</td>
<td class="solution_unit">{PrimaryCurrency}</td>
</tr>
<tr>
<td class="solution_price">{SecondaryPrice}</td>
<td class="solution_unit">{SecondaryCurrency}</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="solution_CONDITION" colspan="4" rowspan="4">{Conditions}</td>
<td class="th_solution_unit">Deadline</td>
</tr>
<tr>
<td class="solution_unit">{Deadline}</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
</div>
</div>
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
PointsWell
Posts: 1460
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Fake a Mandatory Label?

Post by PointsWell »

Thanks Mark!
Wasn't expecting as involved an explanation, that's great.

The issue is that I am trying to get round is on input fields - where their mandatory state is based on other field values, so the HTML route doesn't work in this case.

I've taken a rather crude route to fixing the problem. As the from completion is by a routed wizard I've just manually added the red * to the end of the label. It's inelegant as AIM adds the ':' after the red * so instead of
label name:*
it is showing
label name*:

Suboptimal, but I have more important things to do at the moment.
For other fields where the interaction is more complex ie for tax registrations, where either no fields are completed or all fields are completed, I have reverted to an HTML cell underneath the field with an evaluation and SHOW SECTION_START
Post Reply