Jump to content

suppress graphic based on user selection


EricC

Recommended Posts

I created a FusionPro template (a business card) for my printOne catalog.

 

I have a drop down list which has the following selections:

- Standard

- Enhanced

 

I also have a graphic box which allows the user to upload a photo.

 

I want the following limitation: The user can ONLY include a photo on their business card if they select 'Enhanced'

 

So it sounds like I need to write a rule that says:

"if user selects 'Standard', suppress the graphic ... EVEN IF one was uploaded"

 

The reason I need to do this is because:

(a) some people don't read and

(b) as far as I know, in a printOne store there is no way to disable (or hide) a field based on another selection.

 

In other words, nothing prevents the user from selecting 'Standard' and then uploading a photo anyway!

 

Is there a way to do this with javascript? (Keep in mind ... Since the user can upload their own photo, I wont know the _name_ of the photo).

 

So I suppose I need a way to suppress a graphic box regardless of what the name of the graphic image inside of it is named.

Link to comment
Share on other sites

Sure, just have the rule return an empty graphic for the frame based on that condition:

 
if (Field("MyFieldName") == "Standard")
 return NullResource();
//else
// <<whatever else your rule was going to do anyway>>

In FusionPro 6.0, you can also suppress individual graphic and text frames by name without creating a new rule for each one.

Link to comment
Share on other sites

  • 4 weeks later...

OK ... here's where I'm at ...

 

Dan's rule says "If field name = standard, suppress the graphic"

 

But my rule needs to do the following: (this is going to be on a printOne website, where a user can upload his/her own image)...

 

"If field name = standard, suppress the graphic.

Else, return the graphic file that the user uploaded"

 

Since I wont know the name of the file that the user uploaded, I can't hard-code the file name ... how do I do this?

Link to comment
Share on other sites

But my rule needs to do the following: (this is going to be on a printOne website, where a user can upload his/her own image)...

 

"If field name = standard, suppress the graphic.

Else, return the graphic file that the user uploaded"

 

Since I wont know the name of the file that the user uploaded, I can't hard-code the file name ... how do I do this?

I'm not sure how FP Web handles the graphic uploads, or how you would access an arbitrary one. I think you can associate the uploaded graphic to a particular field or named resource, but I don't know exactly how that works. You might want to ask in the FP Web Forum.

Link to comment
Share on other sites

I would start with a CreateResource rule that looks at the particular field you are using for the user to upload. In the sample below the filed is called "UploadFile". Since the image files are usually linked to a specific library in the manager most of the times you might not need an image path but you will for testing purposes on your desktop version.

 

//I use a Mac to test

if(FusionPro.isMac)

ImagePath = "\Images:";

 

//FP Web is a Windows server

if(FusionPro.isWindows)

ImagePath = "";

 

 

 

bPic = CreateResource(ImagePath + Field("UploadFile"), "graphic");

 

if (Field("MyFieldName") == "Standard" && Field("MyFieldName") != "" )

return NullResource();

else

return bPic;

 

The only problems you might see is that the user uploads a file with a long name or has exception characters. You will also probably want to make the field that has the "Standard" and "Enhanced" dropdowns a non-blank dropdown to avoid a rule error.

 

HTH

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...