Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Looking to lock form on email submission and set something from the form in the email subject

Avatar

Avatar
Ignite 3
Level 3
lostfrogg
Level 3

Likes

8 likes

Total Posts

66 posts

Correct Reply

0 solutions
Top badges earned
Ignite 3
Ignite 1
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Ignite 3
Level 3
lostfrogg
Level 3

Likes

8 likes

Total Posts

66 posts

Correct Reply

0 solutions
Top badges earned
Ignite 3
Ignite 1
Give Back 5
Give Back 3
Give Back 25
View profile
lostfrogg
Level 3

13-10-2020

I have added an email submission button. I've looked around but can't seem to find the answer to this - how do I lock the form on submission? The form has an auto-populate today's date box, and currently every time I open the form it resets it to the current date. 

Second, I have fields on the form for "forename" and "surname". Would it be possible to have the following in the "email subject": 

[specific text] - (forename initial) (surname initial)

 

Thanks!

Replies

Avatar

Avatar
Establish
Employee
Kosta_Prokopiu1
Employee

Likes

149 likes

Total Posts

340 posts

Correct Reply

96 solutions
Top badges earned
Establish
Give Back 5
Give Back 3
Give Back 25
Give Back 10
View profile

Avatar
Establish
Employee
Kosta_Prokopiu1
Employee

Likes

149 likes

Total Posts

340 posts

Correct Reply

96 solutions
Top badges earned
Establish
Give Back 5
Give Back 3
Give Back 25
Give Back 10
View profile
Kosta_Prokopiu1
Employee

14-10-2020

Since you packed 2 questions into 1 I answer the second one first.

Define your Submit by Email button WITHOUT the Email Subject: field.

 

Capture.PNGCapture.PNG

Then go to the preSubmit event of the Email button and place the following script there

var sMailUrl=this.resolveNode("#event").submit.target;
this.resolveNode("#event").submit.target=sMailUrl + "?subject=Some Text "+Forname.rawValue+" "+Surename.rawValue;

 

Capture.PNG

 

Capture.PNG

Avatar

Avatar
Establish
Employee
Kosta_Prokopiu1
Employee

Likes

149 likes

Total Posts

340 posts

Correct Reply

96 solutions
Top badges earned
Establish
Give Back 5
Give Back 3
Give Back 25
Give Back 10
View profile

Avatar
Establish
Employee
Kosta_Prokopiu1
Employee

Likes

149 likes

Total Posts

340 posts

Correct Reply

96 solutions
Top badges earned
Establish
Give Back 5
Give Back 3
Give Back 25
Give Back 10
View profile
Kosta_Prokopiu1
Employee

14-10-2020

Regarding your date field. Assuming that you used the Current Date field from the Custom library:

Just add an if to the ready:layout event of the date field so that it looks like that:

if ($ == null) then
   $.rawValue = num2date(date(), DateFmt(1))
endif

That should prevent the repeated prefilling once a date has been set.

In JavaScript

if (this.rawValue == null) {

   your code

}

Avatar

Avatar
Ignite 3
Level 3
lostfrogg
Level 3

Likes

8 likes

Total Posts

66 posts

Correct Reply

0 solutions
Top badges earned
Ignite 3
Ignite 1
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Ignite 3
Level 3
lostfrogg
Level 3

Likes

8 likes

Total Posts

66 posts

Correct Reply

0 solutions
Top badges earned
Ignite 3
Ignite 1
Give Back 5
Give Back 3
Give Back 25
View profile
lostfrogg
Level 3

14-10-2020

Many thanks for your answer. Is it possible to have it show the name initials in the subject line? So instead of "Kosta Prokopiu", it would show "KP"?

 

Also, I presume that I have to put in the "long" paths to the forename and surname fields in the script?

 

Thanks

Avatar

Avatar
Ignite 3
Level 3
lostfrogg
Level 3

Likes

8 likes

Total Posts

66 posts

Correct Reply

0 solutions
Top badges earned
Ignite 3
Ignite 1
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Ignite 3
Level 3
lostfrogg
Level 3

Likes

8 likes

Total Posts

66 posts

Correct Reply

0 solutions
Top badges earned
Ignite 3
Ignite 1
Give Back 5
Give Back 3
Give Back 25
View profile
lostfrogg
Level 3

14-10-2020

Thanks - I have this in the layout:ready event of the date field (in FormCalc):

 

if ($ == null) then
$.rawValue = Num2Date(Date(), "YYYY-MM-DD")
endif

 

When I try and submit the form however, I get an error message:

 

"The value you entered for Current date: is invalid. To ignore validations for Current date; click Ignore."

 

If I click ignore, it will submit the form, but the auto-calculated date field doesn't lock and just updates again whenever the form is opened.

 

 

Avatar

Avatar
Establish
Employee
Kosta_Prokopiu1
Employee

Likes

149 likes

Total Posts

340 posts

Correct Reply

96 solutions
Top badges earned
Establish
Give Back 5
Give Back 3
Give Back 25
Give Back 10
View profile

Avatar
Establish
Employee
Kosta_Prokopiu1
Employee

Likes

149 likes

Total Posts

340 posts

Correct Reply

96 solutions
Top badges earned
Establish
Give Back 5
Give Back 3
Give Back 25
Give Back 10
View profile
Kosta_Prokopiu1
Employee

14-10-2020

Check your locale and date format in the patterns. Apparently the "date string" of the prefill does not match what the validation pattern expects.

Avatar

Avatar
Establish
Employee
Kosta_Prokopiu1
Employee

Likes

149 likes

Total Posts

340 posts

Correct Reply

96 solutions
Top badges earned
Establish
Give Back 5
Give Back 3
Give Back 25
Give Back 10
View profile

Avatar
Establish
Employee
Kosta_Prokopiu1
Employee

Likes

149 likes

Total Posts

340 posts

Correct Reply

96 solutions
Top badges earned
Establish
Give Back 5
Give Back 3
Give Back 25
Give Back 10
View profile
Kosta_Prokopiu1
Employee

14-10-2020

this.resolveNode("#event").submit.target=sMailUrl + "?subject=Some Text "+Forname.rawValue+" "+Surename.rawValue + "(" + Forname.rawValue.substr(0,1) + Surename.rawValue.substr(0,1) + ")";

adds your initials like Some Text Kosta Prokopiu(KP)

Paths depend on where the objects are. With me they are in the same level - in your case you may require the full path.

Avatar

Avatar
Ignite 3
Level 3
lostfrogg
Level 3

Likes

8 likes

Total Posts

66 posts

Correct Reply

0 solutions
Top badges earned
Ignite 3
Ignite 1
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Ignite 3
Level 3
lostfrogg
Level 3

Likes

8 likes

Total Posts

66 posts

Correct Reply

0 solutions
Top badges earned
Ignite 3
Ignite 1
Give Back 5
Give Back 3
Give Back 25
View profile
lostfrogg
Level 3

28-10-2020

Hi Kosta,

Thanks again for your input. I'm still struggling to get the date field to lock.

Regarding the code you told me to put into the layout:ready field - do I just copy your code and paste it in? I don't need to change anything such as DateFmt? Should that code all be in FormCalc rather than JavaScript?

When I change the DateFmt and have the following code in layout:ready with language set to FormCalc:

if ($ == null) then
$.rawValue = Num2Date(Date(), "YYYY-MM-DD")
endif

then the form fills in OK and I don't get any error message, but after submitting the form it doesn't lock the field, with the date updating each time I open the form.

When I just copy and paste it in, with the option set to formcalc, I can fill in the form OK and don't get a validation error message, but the field is not locked after submitting the form, and updates each time I open that form.

Locale for this field is set to "default locale" which is "English (USA)".

Thanks!

 

Avatar

Avatar
Establish
Employee
Kosta_Prokopiu1
Employee

Likes

149 likes

Total Posts

340 posts

Correct Reply

96 solutions
Top badges earned
Establish
Give Back 5
Give Back 3
Give Back 25
Give Back 10
View profile

Avatar
Establish
Employee
Kosta_Prokopiu1
Employee

Likes

149 likes

Total Posts

340 posts

Correct Reply

96 solutions
Top badges earned
Establish
Give Back 5
Give Back 3
Give Back 25
Give Back 10
View profile
Kosta_Prokopiu1
Employee

28-10-2020

Check out my sample. The way I use this form is to open it in Reader, today`s date is prefilled. For testing I set it manually to yesterday and then Save As another file (emailing2.pdf). When I open emailing2.pdf I get yesterday's date - which is expected result.

https://documentcloud.adobe.com/link/review?uri=urn:aaid:scds:US:e600abc1-348d-47c7-b832-a71183a1a5a...

Avatar

Avatar
Ignite 3
Level 3
lostfrogg
Level 3

Likes

8 likes

Total Posts

66 posts

Correct Reply

0 solutions
Top badges earned
Ignite 3
Ignite 1
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Ignite 3
Level 3
lostfrogg
Level 3

Likes

8 likes

Total Posts

66 posts

Correct Reply

0 solutions
Top badges earned
Ignite 3
Ignite 1
Give Back 5
Give Back 3
Give Back 25
View profile
lostfrogg
Level 3

28-10-2020

Thanks for that Kosta. I'm sorry, I've been an idiot. I've been working on the current date field, but testing on the current time field, for which I have not entered any code! Would you be able to advise on what I should put in the "current time" field to get it to lock that also?