Expand my Community achievements bar.

SOLVED

Beginner question: How do I hidden a page after to click on the button?

Avatar

Level 4

Hello!

My name is Rafael. I speak from Brazil.

I am new user on the AdobeCycle software

I am doing a form and I need help, please.

My project form has three pages:

1ª Page - Instrucion

2ª Page - form with fields to be fill

3ª Page -  (This page will be hidden). This page will get the informations from the informations filled by user at the 2ª Page . Will be just text.

What Do I want?

When the user to click on the button to send to e-mail, I want that the page with form is hidden and show the 3ª Page only with the information (no fields, only text filled). I want to be send the PDF file to e-mail only with the 1ª Page and 3ª Page (just text with the information).

How do I do this? How do I do the 3ª Page (geting the informations filled of the page two)?

1 Accepted Solution

Avatar

Correct answer by
Level 10

No problem Rafael,

Adobe have a guide here that is very useful for accessing a lot of the features of fields: http://partners.adobe.com/public/developer/en/tips/CalcScripts.pdf

I refer to it a lot.

So on page 164, it looks at how to access/change the colour of the caption AND the value:

TextField1.caption.font.fill.color.value = "R,G,B" // changes the caption colour

TextField1.font.fill.color.value = "R,G,B" // changes the value colour

If you want to change the colour of the border, then this requires a different script. The sample on the blog we mentioned, shows examples on page 2 of changing the colour of borders (second row down): http://assurehsc.ie/blog/index.php/2010/06/laying-out-a-form/

For example:

var vName = this.name.toString();

xfa.resolveNode(vName + ".ui.textEdit.border.edge").stroke = "solid";

for (var i=0; i<4; i++) {

  this.ui.oneOfChild.border.getElement("edge",i).color.value = "255,153,0"; //orange tinge

  xfa.resolveNode(vName + ".ui.textEdit.border").getElement("edge",i).thickness = "0.0200in";

}

In addition here are some links that may be of interest to you: Re: Books or guides for Livecycle Designer

Good luck,

Niall

View solution in original post

32 Replies

Avatar

Level 10

Hi Rafael,

I am glad you have it working.

Here is an updated sample: https://acrobat.com/#d=BVVgy0i-cUtfYwv-DCce8Q

I have added buttons and fields to set out solutions to your questions.

You will need to look at the events in the buttons and fields to see how to implement these in your form.

Good luck,

Niall

Avatar

Level 4

Hello Niall!! You are excelent! Thanks!!

I opened your example, but just the question about the button that I didn't understood yet.

Look. In your example, when I click on the button "Highlight field", it just mark the color the fields. But what I want that the button verificate if the field are filled, and then yes mark with color only the filled that didn't fill. I can using the button at the model "submit" but I don't want tha it send e-mail, just hidden something pages. I already tryed don't put e-mail, but it not works.

Avatar

Level 4

And just more another problem. In all the pages that I put a button "submit" or no, show alert to fill fields in empty. Same the page hidden. Is possible the button to verificate only at the page that it is and not in all?

NOTE: I don't know if is so, but when gerate the page 3 (just text) and I salve and open again, the page don't stay at the page 3, it back to page with fields. Is it so? With you example, I can save e see where I left

Thanks.

Avatar

Level 10

Hi,

I would only recommend one submit button. Otherwise a user may try and submit the form, when there are other fields on subsequent pages.

Stefan Cameron has a great sample for validation on his blog: http://forms.stefcameron.com/2006/06/26/process-all-fields/. This is quite involved scripting.

Rather than having a button to validate each page, I would validate each field on exit. If you use a validate event it will fire every time the form is opened which can be annoying. So something like this in the exit event would help instead:

if (this.rawValue == null || this.rawValue == "")

{

     app.alert("This field is required.\n\nPlease provide your name");

}

This way you are capturing invalid responses as they happen.

If you want to highlight fields that have specifically failed validation then John Brinkman has examples on his blog: http://blogs.adobe.com/formfeed/2008/11/validation_patterns_part_3.html

I hope these help,

Niall

Avatar

Level 4

Hello!

Yes, but it this happen in all the button (Don't it need to be a submit button).  What I don't understand is why it vericate in all the pages.

But I am going try using your example.

Something, I spoke with you.

Thanks!

Avatar

Level 4

Hi Niall.

I am at the job now. I am going try to do this verification using your example (puting at the button event).

But, just a curiosity: Why is there verification in all the pages (subforms)? The correct isn´t verificate only at the page where is the button?

Avatar

Level 10

Hi Rafael,

A standard Submit button will first check that all required/mandatory fields are completed before it continues with the submission. This applies to all required fields (irrespective of where the fields are located). This validation is just to check that required fields are not null.

In addition you can set up validation for each field that can check for a number of conditions. Whether the field is null or if the value matches a set requirement.

It is probably better to have validation in an object, where you require the information is a certain format or minimum value. This would be on a field by field basis.

The last validation run by the regular submit button is just checking that required fields have a value inputted.

There is a lot of good information on validations on Stefan's blog, John's blog and on this forum.

Hope that helps,

Niall

Avatar

Level 4

Hello!

I used you example of validation and it works! But The problem is: Show alert window in all the erros. For example: If the fields: Name and Country will be empty, show two alerts windows. This leave the user upset

I tryed to use so:


var erros;
var confirm_erros;

If (page2.name.rawValue == "")
{
erros =+ "Fill the field name \n";
confirm_erros = true;

}

If (page2.country.rawValue == "")
{
erros =+ "Fill the field Country \n";
confirm_erros = true;

}

if (confirm_erros)
{
app.alert (erros);

}else{
page1.presence = "hidden";

......

}

But it doesn´t works.


Can you help me? Look, I already accessed the blogs you informated for me, but how I am a newbier and my english is very bad, I can´t understand well.


If possible, please, inform me also what the function to mark the field.

NOTE: LOL, I still can´t understand why the Adobe LiveCycle verication all the pages. I believe that it be a bug.


Thank you.

Avatar

Level 10

Hi Rafael,

Validation can be tricky, as there are many ways to tackle it. If you have LC Designer ES2 (v9) and Acrobat v9, then you can take advantage of the new feature of grouping validation messages into one alert. see File > Form Properties > Form Validation tab:

Parallels Desktop1.png

On the other hand if you script against the validation event, then the alerts will come up when the form is opened.

In relation to your script, one issue may be the '=+', I normally put the plus in front, so '+='. I am not sure if this will make a difference. Also I would not use the string 'name' for an object, this is a reserved word. Try 'fullName'. Also test against a null state. Two of the 'if' had a capital I.

This is working here:

var erros = "";

var confirm_erros;

if (fullName.rawValue == null || fullName.rawValue == "")

{

erros += "Fill the field Name \n";

confirm_erros = true;

}

if (country.rawValue == null || country.rawValue == "")

{

erros += "Fill the field Country \n";

confirm_erros = true;

}

if (confirm_erros)

{

app.alert (erros);

}else{

app.alert("The fields are complete");

}

Good luck,

Niall

Avatar

Level 4

Hi! Yessssssss!! It works!!!

I was viewing the example on the blog (adobe) where it is used the highlihgs fields. At the example it used this script:

this.caption.font.fill.color.value = "100,100,100";

But, I put this in my condicion and it just change the color field decription. Do you know if this function is correct? I want to change just the color border of the field.

About the new Adobe Live Cycle 9, it still is verification the fields in all the pages (even if no button)?

I am going to download it.

Thanks!

Avatar

Level 4

Hello Niall

Dude, sorry to make many question to you. I am learning many things with you! Have sure this!

I need that you ask only last question to finish my form.

When I entered here, I didn´t anything, but with your help, I already many things!


Again, sorry.

Avatar

Correct answer by
Level 10

No problem Rafael,

Adobe have a guide here that is very useful for accessing a lot of the features of fields: http://partners.adobe.com/public/developer/en/tips/CalcScripts.pdf

I refer to it a lot.

So on page 164, it looks at how to access/change the colour of the caption AND the value:

TextField1.caption.font.fill.color.value = "R,G,B" // changes the caption colour

TextField1.font.fill.color.value = "R,G,B" // changes the value colour

If you want to change the colour of the border, then this requires a different script. The sample on the blog we mentioned, shows examples on page 2 of changing the colour of borders (second row down): http://assurehsc.ie/blog/index.php/2010/06/laying-out-a-form/

For example:

var vName = this.name.toString();

xfa.resolveNode(vName + ".ui.textEdit.border.edge").stroke = "solid";

for (var i=0; i<4; i++) {

  this.ui.oneOfChild.border.getElement("edge",i).color.value = "255,153,0"; //orange tinge

  xfa.resolveNode(vName + ".ui.textEdit.border").getElement("edge",i).thickness = "0.0200in";

}

In addition here are some links that may be of interest to you: Re: Books or guides for Livecycle Designer

Good luck,

Niall