PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

How do I set a default image title?

  1. jskyrms
    Member

    I'm working on a project that requires registered users to be able to upload five images as a post. Each set of images will have the same five titles, e.g. first image is titled "Candor," second image is titled "Shadow," etc. Everything works fine if the user enters the titles, but since they are always the same, it would help avoid errors if I could set the value of the title field and, if possible, hide it from the user. I'm new at this. Any ideas on setting a default image title?

    Posted 13 years ago on Tuesday April 3, 2012 | Permalink
  2. Can you post a link to your form so I can visually see this one?

    Posted 13 years ago on Tuesday April 3, 2012 | Permalink
  3. jskyrms
    Member

    Here's a link to the development site: agilechicken.com/upload-your-photos/.

    Posted 13 years ago on Tuesday April 3, 2012 | Permalink
  4. I see, OK, so it sounds like you could go to the Advanced Tab on each Title field and place a default value there and then select Admin only to hide the visibility.

    Posted 13 years ago on Tuesday April 3, 2012 | Permalink
  5. jskyrms
    Member

    Yes, but the Title field is the title meta for the image. I don't see how that can be set from the Advanced Tab.

    Posted 13 years ago on Tuesday April 3, 2012 | Permalink
  6. Ah I'm with ya now. Sorry about that confusion. Hmm, well to hide it, we'd probably have to rely on CSS and/or jQuery. To pre-populate it, you can use jQuery and then also hide it as well. Are you familiar with jQuery at all, in terms of trying this out?

    Posted 13 years ago on Tuesday April 3, 2012 | Permalink
  7. jskyrms
    Member

    I've done a few things using jQuery, but my skills are elementary. On the other hand, I learn reasonably quickly, especially with a bit of guidance. It looks like there are some tutorials on lynda.com. So let's say I can try to figure it out if you could give me the general approach.

    You're being remarkably responsive, btw, so thanks a lot for that.

    Posted 13 years ago on Tuesday April 3, 2012 | Permalink
  8. Right on, glad to help out. So this is how you would target the input and fill it in:

    jQuery(document).ready(function()
    {
    	jQuery("#input_1_2_1").val('Custom value here');
    });

    If you inspect your code, you'll see each input has it's own unique ID. For example, your first input Title has an ID of: input_1_2_1.

    You can either apply a class to each of those title fields and then hide them via CSS that way, or select the class with jQuery and hide it that way. Try that out and see how it goes.

    Posted 13 years ago on Tuesday April 3, 2012 | Permalink
  9. jskyrms
    Member

    Thanks. I'll give it a try. I'm sure it will work great.

    Posted 13 years ago on Tuesday April 3, 2012 | Permalink