This topic is locked

How can I show photos in OrderDetails Add or Edit Pages

2/13/2007 3:30:41 PM
PHPRunner General questions
D
dlpirl author

Is it possible to display product photos in order details Add/Edit pages without making the photos themselves editable? If I try making the photo read only, I just get a message 'LONG BINARY DATA - CANNOT BE DISPLAYED'. If this is not possible, I will stop trying!

J
Jane 2/14/2007

Hi,
you can do the following:

  1. uncheck product photo field on the EDIT page on the Choose fields tab
  2. add EditOnLoad event on the Events tab. Here is a sample:
    function EditOnLoad()

    {

    global $where;

    echo "<img src=\"TableName_imager.php?field=FieldName&key1=".postvalue("editid1")."\">";

    }



where TableName is your actual table name, FiledName is your actual field name.

3. Put yellow Event OnLoad box in any place you want on the Visual Editor tab.
I'm not sure that I understand you correctly. There are no values in the fields on the ADD page. Please clarify what you want to display on the ADD page.

D
dlpirl author 2/18/2007

Thanks, Jane. Here is what I am trying to do... When the Order Details table is in List view with Orders as the Master table,

  1. when 'Add New' is clicked, the user then selects a product from the pop down in the 'Add' screen. The product photo should immediately appear. Or if this is not possible, the photo should appear when 'Save' is clicked.
    and
  2. when 'Edit' is clicked for one of the listed Order Detail items, the user should see a photo for item in the 'Edit' screen. If they then change the product selection from the pop down in the 'Edit' screen, the new product photo should immediately appear. Or if this is not possible, the old photo should immediately disappear and the new photo appear when 'Save' is clicked.
    If clicking 'Save' is needed as a trigger to view the new photos, I would like to add 'mouse over' help text to the 'Save' button to read 'Save and view new photo'.

Alexey admin 2/19/2007

Here is the code for BeforeAdd and BeforeEdit events to display an image after hitting "Submit".

if(postvalue("value_KeyField"))

echo "<img src=\"...imager.php?field=FieldName&key1=".postvalue("valueKeyField")."\">";



Replace FieldNamewith your image field name and KeyFieldwith a key field name (Lookup wizard field I suppose).
To display image just after selecting a value in dropdown box add image displaying code to its onchange handler.

Put your code to BuildSelectControl function in include\commonfunctions.php file.

You need to know Javascript and PHP to implement that.
To add a tooltip to Save button open the page in Visual Editor, select Save button. Then switch to HTML mode and add > title="Save and view new photo"

attribute to the button.