![]() |
jadachDevClub member 3/1/2018 |
Hi Guys, On my add page I have two fields, "Duration" and "Alert". I'm trying to create a simple Javascript onLoad IF statement that will insert the words "Expires soon" in the "Alert" field if the number in the "Duration" fields is <=90. If the number in the "Duration" field is above >=90 the field should display "No Warning". Getting the above working would be great! However to make the statement perfect I would love to introduce a third field called "Course". The ideal statement would now look the "Course" field and if the course title is called for example "Medical" ( which has a 180 day warning) the statement would look at the duration and if above 180 days for this specific course, display the words "Expires soon" in the "Alert" field. You can also look to use auto-fill with lookup for your more complex question regarding course. Else display "No warning" is the duration is above the warning limit for this specific course. Any inspiration or tips would be much appreciated, my code is below. Best wishes, J
|
![]() |
Admin 3/1/2018 |
Try this:
|
![]() |
woodey2002 author 3/1/2018 |
Wow Thanks Guys!!! |
![]() |
woodey2002 author 3/2/2018 |
This is still crushing my head!
|
![]() |
jadachDevClub member 3/3/2018 |
This is still crushing my head! By using the oninput or onChange field event, the user still needs to add the number manually to the "Duration" field. However switching to mousemove field event, gives me some of the behaviour I require, however it is not ideal. The problem is that the value for the "Duration" field is not typed in by the user themselves rather it is automatically calculated and added via a separate Javascript event. Is there a way I can get to, insert the words "Expires soon" in the "alert" field if the number in the "Duration" fields is <=90? Remember a user does not add the value to the "duration" field manually themselves, the "duration" value is added via the Javascript event and not user input? Do I really even need a field event to insert the words if criteria is met? Best wishes and many thanks! You may have answered your own question. If it were me, I would pass the data to alert after record is added via event. This would be based on the value of duration. J
|
![]() |
woodey2002 author 3/3/2018 |
|
![]() |
woodey2002 author 3/3/2018 |
Cool Jerry, will give that a go now! |
![]() |
jadachDevClub member 3/3/2018 |
What are you using to populate duration? Can you share that code? |
![]() |
woodey2002 author 3/3/2018 |
What are you using to populate duration? Can you share that code?
var ctrDuration = Runner.getControl(pageid, 'staff_mandatory_Study_Day_Duration');
|
![]() |
woodey2002 author 3/11/2018 |
Hi Guys, var ctrDuration = Runner.getControl(pageid, 'staff_mandatory_Study_Day_Duration'); |