Expand my Community achievements bar.

How can I create a submit button that only saves?

Avatar

Level 3

Our end users will save the completed form and later upload it to anotherg place.  I created a save button that works fine, but without a Submit button there is nothing to trigger the reminder to go back and answer required questions.  I don't want to lose that part.  Thanks in advance for any help you can offfer!

15 Replies

Avatar

Level 3

Another option would be to set the Save button to trigger the user to answer the required questions, but I'm not sure how to get the save button to act like a submit button in this fashion.

Avatar

Level 7

Would something like this work for you?

var OKToSave = true;

if (tfSomething.isNull) {

          tfSomething.border.edge.color.value = "255,0,0";

          OKToSave = false;

}

else tfSomething.border.edge.color.value = "255,255,255";

if (!OKToSave) app.alert("Please fill in all required fields");

else app.execMenuItem("SaveAs");

Avatar

Level 3

That may work.  I think I get the idea of it, but I'm not sure where to place it and under which event.  Maybe click event for the save button?

Avatar

Level 7

That's where I put it when I mocked up an example rq.

Avatar

Level 3

For some reason, it didn't do anything when I tried it.  I didn't get an error of any kind.  It just didn't work.

I'm using it in the click event of a save button I have at the end of the form.  My save button is actually the generic button object with the script to make it save.

Am I supposed to plug something in the place of "tfsomething"?  Sorry don't kow much about scripting.

Avatar

Level 7

Yes, tfSomething is an example name for a text field. I don't know what fields you're actually verifying, so I just made one up.

Each field will need a similar if statement to verify.

Avatar

Level 3

So just to clarify, all questions that I need to be required would need a if statement.  Almost every question The form has many questions and they will almost all be required.

Avatar

Level 3

Still can't seem to get this to work even when filling in a value for tfsomething

Avatar

Level 7

Yes, all required questions need an if statement.

Do you have a field named "tfSomething"? If not, you'll need to change tfSomething to whatever you named the fields that are required.

Avatar

Level 3

Just to test it, I put the above script in the click event of my save button object and replaced "tfsomething" with the name of a required text field in the form and it still didn't do anything.  I didn't get an error, but nothing happens when I click the save button at the end of the form. What am I missing?

Avatar

Level 7

Here's the sample I made up.

https://workspaces.acrobat.com/?d=hMjScb4EODKRmYzEiAAE*A

If you want, I can look at your form for you (presuming there isn't an issue with security clearance or something).

Avatar

Level 3

I see that your example works. That is exactly what I need. I would have to get permission to send you my form. For now, I'll keep playing with it.

Is there another variable I should be plugging in a value for?

Thanks so much for all the help!

Avatar

Level 7

It's probably not a variable issue.

What actually happens if you just click the button?

If nothing happens, then the problem is most likely with referencing the field. Try highlighting the field name in the script, then ctrl + click the field you're checking. That causes LC to add the name for you, so if it needs additional names to reference (like the name of a subform that contains it) it will be added automatically.

If you get the error pop up that says "fill in required fields", then the problem is with the second reference inside the if statement. It has to be changed, too.

Avatar

Level 3

Sorry for the late response. I had to go out of town.

Thank you for this reply. I'm actually not getting any response at all when I click on the button, so I assume it is the first option you mentioned. I'll try what you suggest and see if I can't get this thing working.

I've been working on this form for over a month and it is my first experience with LC. I've also never done any scripting with Java. You have been extremely helpful! Thanks again.

Hunter

Avatar

Level 3

I'm totally getting stuck with this.

Is there a single script that could be placed in the click event of the save button I created that would cause it to hold the same validation cues as the submit button? Then the users could save the form and in doing so it would alert them to any questions that were left unanswered. Then they could submit the form via our internal system here instead of being forced to submit via email.

Hunter