Author Topic: Please Help: How do I set default of radio button of additional fields to 'no'?  (Read 11572 times)

0 Members and 1 Guest are viewing this topic.

Offline Kjeld

  • Newbie
  • *
  • Posts: 27
    • View Profile
    • iKjeld.com
I have just created 2  to $additional_image_fields.
One is for 'Model release', the other for 'Property release'.
When I added the new fields to the MySQL database, I set the default to '0' in the database.

The new fields are displayed correctly in the administration for entering new images.
However, they show 'yes' as the default selection. I want 'no' as the default.

I have spent many hours searching the forum and trying out solutions, but can't figure it out...   :?
I imagine that a solution for this issue would help lots of people. And I really need the help.

Please help. How do I set the default to 'no' for these 2  $additional_image_fields?

PS
I am using 4images version: 1.7.2
« Last Edit: April 17, 2006, 11:02:24 PM by Kjeld »

Offline Kjeld

  • Newbie
  • *
  • Posts: 27
    • View Profile
    • iKjeld.com
Re: How to set radio button of $additional_image_fields to 'no'?
« Reply #1 on: April 16, 2006, 07:10:49 PM »
It seems this should be eays to solve... I can' figure it out, though. Please help.

Offline Kjeld

  • Newbie
  • *
  • Posts: 27
    • View Profile
    • iKjeld.com
I just changed the wording of my original question as I am getting no response.

Noboby knows how to do solve this? Please help.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
try this:
in admin/images.php find:
Code: [Select]
    show_additional_fields("image", array(), IMAGES_TABLE, $i);
Replace with:
Code: [Select]
    show_additional_fields("image", array("field1 => 0", "field2" => 0), IMAGES_TABLE, $i);

In admin/admin_functions.php find:
Code: [Select]
        show_radio_row($val[0], $field_name, ($value == "") ? 1 : $value);
Replace with:
Code: [Select]
        show_radio_row($val[0], $field_name, ($value === "") ? 1 : $value);

I dont know how these changes will affect other radio buttons (including none-custom)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Kjeld

  • Newbie
  • *
  • Posts: 27
    • View Profile
    • iKjeld.com
try this:
in admin/images.php find:
Code: [Select]
    show_additional_fields("image", array(), IMAGES_TABLE, $i);
Replace with:
Code: [Select]
    show_additional_fields("image", array("field1" => 0, "field2" => 0), IMAGES_TABLE, $i);

In admin/admin_functions.php find:
Code: [Select]
        show_radio_row($val[0], $field_name, ($value == "") ? 1 : $value);
Replace with:
Code: [Select]
        show_radio_row($val[0], $field_name, ($value === "") ? 1 : $value);

I dont know how these changes will affect other radio buttons (including none-custom)

Thanks a lot for helping, V@no. I am always amazed at all your helpful advice in this forum.

I followed the instructions above exactly, but it doesn't change the settings of the radio buttons.

I noticed you used "field1 => 0" but "field2" => 0

Was this on purpose?

Also, should I change 'field1' and 'field2' with the field names that I use?
« Last Edit: April 18, 2006, 02:54:48 AM by V@no »

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Also, should I change 'field1' and 'field2' with the field names that I use?
I guess I forgot to mention that...:oops:
Yes, change these to the name of your new fields that you want set to "no" by default.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Kjeld

  • Newbie
  • *
  • Posts: 27
    • View Profile
    • iKjeld.com
Thanks, V@no! That did the trick. I also had to make a tiny change in the code.

WAS
Code: [Select]
show_additional_fields("image", array("field1 => 0", "field2" => 0), IMAGES_TABLE, $i);
SHOULD BE (the quotation mark for 'field1' has been moved)
Code: [Select]
show_additional_fields("image", array("field1" => 0, "field2" => 0), IMAGES_TABLE, $i);
Thanks a lot.

This is a small change code wise, but it has a huge result in the work load. When uploading hundreds of images at a time, each click counts.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
not my fault, its browser's fault! j/k ;) (updated)

This is a small change code wise, but it has a huge result in the work load. When uploading hundreds of images at a time, each click counts.
really? ever consider FTP upload? ;)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Kjeld

  • Newbie
  • *
  • Posts: 27
    • View Profile
    • iKjeld.com
Yes, I upload by ftp and then use 'Check new images'. You still have to click the appropriate buttons for each image, right? Or is there another method?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
You still have to click the appropriate buttons for each image, right?
Not quiet sure what do you mean...in check images? if you use "detailed view" ? if so, then you can do the exact same changes as in images.php but in checkimages.php ;)
Still, IMO, FTP method is much quicker then selecting each image one-by-one ;)

Good luck.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Kjeld

  • Newbie
  • *
  • Posts: 27
    • View Profile
    • iKjeld.com
Yes, I use the detailed view so that I can click on the IPTC buttons for caption and keywords. Now I will also need to check 'yes' if an image has a model or property release.

V@no, I have one more question that I can't seem to find an answer for in the forum.

After adding the new fields and following your excellent advice above, I have added this to details.html:

Code: [Select]
{if image_property}YES{endif image_property}
But I get no results... Do I perhaps have to change another file as well?

Must have been a caching problem of my browser...
« Last Edit: April 18, 2006, 03:46:26 AM by Kjeld »