4images Forum & Community

4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: Kjeld on April 15, 2006, 12:22:22 AM

Title: Please Help: How do I set default of radio button of additional fields to 'no'?
Post by: Kjeld on April 15, 2006, 12:22:22 AM
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
Title: Re: How to set radio button of $additional_image_fields to 'no'?
Post by: Kjeld on April 16, 2006, 07:10:49 PM
It seems this should be eays to solve... I can' figure it out, though. Please help.
Title: Re: Please Help: How do I set default of radio button of additional fields to 'no'?
Post by: Kjeld on April 17, 2006, 11:04:49 PM
I just changed the wording of my original question as I am getting no response.

Noboby knows how to do solve this? Please help.
Title: Re: Please Help: How do I set default of radio button of additional fields to 'no'?
Post by: V@no on April 18, 2006, 02:10:29 AM
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)
Title: Re: Please Help: How do I set default of radio button of additional fields to 'no'?
Post by: Kjeld on April 18, 2006, 02:26:57 AM
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?
Title: Re: Please Help: How do I set default of radio button of additional fields to 'no'?
Post by: V@no on April 18, 2006, 02:37:06 AM
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.
Title: Re: Please Help: How do I set default of radio button of additional fields to 'no'?
Post by: Kjeld on April 18, 2006, 02:48:32 AM
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.
Title: Re: Please Help: How do I set default of radio button of additional fields to 'no'?
Post by: V@no on April 18, 2006, 02:56:25 AM
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? ;)
Title: Re: Please Help: How do I set default of radio button of additional fields to 'no'?
Post by: Kjeld on April 18, 2006, 03:01:04 AM
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?
Title: Re: Please Help: How do I set default of radio button of additional fields to 'no'?
Post by: V@no on April 18, 2006, 03:16:33 AM
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.
Title: Re: Please Help: How do I set default of radio button of additional fields to 'no'?
Post by: Kjeld on April 18, 2006, 03:24:51 AM
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...