Skip to main content
Known Participant
May 4, 2021
Answered

Javasript help

  • May 4, 2021
  • 2 replies
  • 4439 views

box1 = 500

box2

box3 = box1- box2

I want the field value from box1 to display and active only when there is value in box2.

The script please For box1?

 

This topic has been closed for replies.
Correct answer Nesa Nurani

Try this:

event.value = this.getField("box2").value != "" ? 500 : "";

2 replies

BarlaeDC
Community Expert
Community Expert
May 5, 2021

Hi,

 

Can I clarify what you want to happen.

Starting point of document

[box1 hidden]

box2 has no value

box3 = ????

 

Then the user enters a value in box2

box1 = 500

box2 = 10

box3 = 490

 

So the key parts are what does box3 equal when box1 is hidden, as hidden just means the user can't see it?

PELOUAuthor
Known Participant
May 5, 2021

I meant to say leave the field blank

 

Nesa Nurani
Community Expert
Community Expert
May 5, 2021

As validation script of box2 use this:

this.getField("box1").value = event.value != "" ? 500 : "";
PELOUAuthor
Known Participant
May 6, 2021

I'm sorry since box2 already have another script when i try to add this script to the bottom of it, it is not working. The new script that i need has to be in box1

Inspiring
May 6, 2021

You have script in validation or calculation?