- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2018 08:58 PM
i have a field which should have mandatory symbol (*) and when i enter the values it should change from red to grey..
<label>Name : </label>
<input type="text" ng-model="name" id="demo" />
can i use it for the above the code...without using jelly script
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2018 12:24 AM
Here is the full code
HTML
<label for="input1" id="inputLabel" >Name</label>
<input type="text" ng-model="name" onchange="checkMandatory()" id="demo" />
Client script
document.getElementById('inputLabel').setAttribute("class", "required");
function checkMandatory(){
if(document.getElementById('demo')!="")
document.getElementById('inputLabel').setAttribute("class", "notrequired");
}
css
label.required::before {
content: '*';
margin-right: 4px;
color: red;
}
label.notrequired::before {
content: '*';
margin-right: 4px;
color: grey;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2018 10:03 PM
Hi
Just try with something like this once :-
gel('demo').required = true in your client script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2018 10:23 PM
didnt work...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2018 10:35 PM
Hi
Please find the below link for the answer given by Chuck.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2018 11:07 PM
the link which u have given uses jelly script can i do that without jelly script..

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2018 11:14 PM
Try writing it inside <g:ui_form> once and let me know.
Like this :-
<g:ui_form>
<input type="text" id="demo" required/>
</g:ui_form>