Jump to content
  • 0

Updating A Unique Field


bookish

Question

Happy new year! Could someone help me in this script? I am trying to edit a unique field in an update form. It allows me to edit f I select a text field. But to prevent the user from making a mistake, i enclosed the field in 2 html blocks 

<table style="display:none;">

</table>

 

I place this script in the footer. It does show the right answer {(I tested using document.write(res)] and confirmation email is sent, but the unique field is not changed. 

 

<SCRIPT LANGUAGE="JavaScript">

var str = "[@field:combined_ID]"
var res = str.slice(0,16);
document.getElementById("InsertRecordcombined_ID").value = res;

</script>

 

Thanks in advance.

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Hi everyone! I hope you can help me. The deprecation of the option to disable AJAX loading will affect this code that needed a table tag <table style="display:none;">. What would be my alternative so that I can still have no one see the combination created after every form submission.

<SCRIPT LANGUAGE="JavaScript">

var iID = document.getElementById("InsertRecordID").value;

var iACTIVITY_TYPE = document.getElementById("InsertRecordACTIVITY_TYPE").value;

var combined_ID = iID + iACTIVITY_TYPE;

document.getElementById("InsertRecordcombined_ID").value = combined_ID;

</SCRIPT>

On 1/9/2014 at 7:06 AM, MayMusic said:

If it is an update for you should change document.getElementById("InsertRecordcombined_ID").value = res; to document.getElementById("EditRecordcombined_ID").value = res;

On 1/2/2014 at 4:58 PM, bookish said:

Happy new year! Could someone help me in this script? I am trying to edit a unique field in an update form. It allows me to edit f I select a text field. But to prevent the user from making a mistake, i enclosed the field in 2 html blocks 

<table style="display:none;">

</table>

 

I place this script in the footer. It does show the right answer {(I tested using document.write(res)] and confirmation email is sent, but the unique field is not changed. 

 

<SCRIPT LANGUAGE="JavaScript">

var str = "[@field:combined_ID]"
var res = str.slice(0,16);
document.getElementById("InsertRecordcombined_ID").value = res;

</script>

 

Thanks in advance.



 

Link to comment
Share on other sites

  • 0

Hello @bookish,

My understanding of your workflow is the following:

- this is the Submission Form DataPage;

- the user populates the 'RecordID' and the 'ACTIVITY_TYPE' fields;

- the 'combined_ID' field should store the combination of those 2 values.

If this is correct, you can apply the easier solution. Instead of using JavaScript, you can utilize Calculated value.

For that, select the 'Calculated Value' Form element for the 'combined_ID' field and add the calculation you need.

ipFnqQA.png

When the Form element is 'Calculated value', on the Advanced tab there is an option to hide this field:

g6quGic.png

An example with the visible 'combined_ID' field to showcase the approach:

fdvd78Y.png

If the workflow is different, please provide more details about the DataPage type, and form elements of the fields involved in this workflow.

 

Link to comment
Share on other sites

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...
×
×
  • Create New...