Announcement

Collapse
No announcement yet.

dynamically change HTML Images in Event on Record

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • dynamically change HTML Images in Event on Record

    Hello,
    I have upload 2 images in my project.
    Now I have to decide in an if clause which of These images should be displayed in each line.

    Is there a scriptcase macro to define which of these 2 Images will be displayed?


    ---------------------------------------------------------------------------
    for example:

    if ({field1} == 1)
    {
    //what code should I do here?
    $Image = 'grp__NM__correct_kl.gif';
    }
    else
    {
    //what code should I do here?
    $Image = 'grp__NM__wrong_kl.gif';

    }
    Best regards: - Simon -

  • #2
    Are the images in a directory or in the database? If the image is on disk you could consider creating a custom field and put the url into it.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      Hello,
      thanks for your help, but my Images are not physically on my space.
      I upload them in scriptcase for this field. So I can change them when it is possible and they are deployed automatically on my productive system when I finish the deployment.


      Is there a macro what help me to Change dynamically or is the only way to save the Image physically and then made an html code like
      <img border="0" src="../wwwroot/img.gif">.....
      Best regards: - Simon -

      Comment


      • #4
        You can set the field type to HTML Image and use the where criteria or an even to pull up just the one record and show the image from that record. Forms usually only show 1 record, but you could even make a grid show just one record. I have done both, as well as more custom code for control apps, etc. You might find starting with a grid will help you. Make it so all your records each show thier image in it image field, then you can play with the where to get just one record. The you can play with changing the settings on the grid, from horizontal to vertical, remove all the unneeded controls (so the user can't click on a bottom arrow to move anywhere).

        SC does a good job with images in DB tables. I tend to use DB stored images almost always, except for very static images (like a logo) that I might just use the SC image upload to store once and use in the headers of apps. However, the advantage to using images in a DB is that you can easily back up all your data in the DB and not worry about flat files/folders of images. The downside is that the could be speed issues, possibly. But realistically, unless you are building a site that will get a million hits a day, the mySQL Db will be able to keep up. I have not had issues so far.

        SC has a lot of possibilities, so good luck! No one way to do anything.

        Comment

        Working...
        X