Jump to content
  • 0

Calculated Value Field Not Working With Button Click


RonAnderson
 Share

Question

Hi, I have a submission datapage which has three groups of elements

1. 3 buttons (Javascript) each aligned to 3 respective text fields Which when clicked, enters a string into the relevant text field.

2. 3 text fields which takes the string from the respective button click event OR a direct entry from the user

3. A calculated value in a text field which monitors the state of each textfield and give a score when the each text field is populated.

The problem is that the entry to the text field using the button click event doesn't register to the calculated  value field but it does register if I manually enter a string to the text fields.

I'm using the following formula in the calculated value

CASE
WHEN ([@field:Manufacturer]>"") AND ([@field:Model]="") AND ([@field:Serial_Number]="")
 THEN 1
WHEN ([@field:Manufacturer]>"") AND ([@field:Model]>"") AND ([@field:Serial_Number]="")
 THEN 2
WHEN ([@field:Manufacturer]>"") AND ([@field:Model]>"") AND ([@field:Serial_Number]>"")
THEN 3
END

Here's the javascript code to button number 1:-

</script><input type="button" value= "Click here" id="button1" /> if Manufacturer Unknown
<script type="text/javascript">
document.getElementById("button1").addEventListener('click', function () {
    var text = document.querySelector('[id^="InsertRecordManufacturer"]');
    text.value = 'No Manufacturer ID';
});
</script>

I'd welcome any suggestions or help with this.

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...