ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Standalone forms and dynamic titles

March 22, 2010 7:59pm

Subscribe [3]
  • #1 / Mar 22, 2010 7:59pm

    Special Kay

    8 posts

    Hi team,

    I have built a standalone form which submits data to a weblog. In this example the title is irrelevant and therefore could be anything at all but because a weblog entry requires a title I need to fill it. Ideally I would like to dynamically populate the title field based on input information or turn it off for that matter - is that possible?

    To give you an example:

    I have a form which looks like this:

    Title
    
          <input type="text" name="title" id="title" value="{title}" size="50" maxlength="100"></p>
          
          {custom_fields}
          {if required}* {/if}{field_label}
    
    
          {if textarea}
          <textarea name="{field_name}" dir="{text_direction}" cols="50" rows="{rows}">{field_data}</textarea>
          {/if}
    
          {if textinput}
          <input type="text" dir="{text_direction}" name="{field_name}" value="{field_data}" maxlength="{maxlength}" size="50">
          {/if}
    
          {if pulldown}
          <select name="{field_name}">
          {options}<option value="{option_value}"{selected}>{option_name}</option>{/options}
          </select>
          {/if}
    
          {if date}
          <input type="text" name="{field_name}" value="{field_data}" maxlength="{maxlength}" size="50">
          {/if}
    
          {if relationship}
          <select name="{field_name}">
          {options}<option value="{option_value}"{selected}>{option_name}</option>{/options}
          </select>
          {/if}
          {/custom_fields}

    How can I go about doing this? Would the following work?

    <input type="hidden" name="title" id="title" value="field_ft_36" size="50" maxlength="100" /></p>

    Kind regards,
    Special Kay

  • #2 / Mar 23, 2010 12:41pm

    guru24

    40 posts

    <input type="hidden" name="title" id="title" value="field_ft_36" size="50" maxlength="100" /></p>

    I’m pretty sure that won’t work, but my SAEF toolkit module does include this functionality and a lot more. PM if you’re interested in testing it when it’s ready.

  • #3 / Mar 23, 2010 2:27pm

    Robin created a small extension that enables auto population of the title field from an input field, see this post.

  • #4 / Mar 24, 2010 6:42pm

    Special Kay

    8 posts

    @Paul - thank you for the extension matey - have you used it before?
    It works well until you change the fields order on the form then it breaks… any ideas?

    @guru24 - PM when your module is ready for testing buddy, i’d be more than happy to support you.

  • #5 / Mar 24, 2010 7:54pm

    Yes, I’ve been using it on a site for the last year without any problems.
    Not sure what you mean about changing the field order. Once you set the field_id_(number) it shouldn’t make any difference which order the fields are in the form.

    I use it on a booking form for an activity course, where I add the name they input to a reference number of the course they are booking. The reference number is also a hidden field that gets it’s input from a weblog field that wraps around the input form.

  • #6 / Mar 24, 2010 10:26pm

    Special Kay

    8 posts

    @Paul - you were right as the orders have nothing to do with the field ID - I assumed they did while testing the extension. I have one more question for you - I also have another page on my site which a selected number of users can ‘edit’ the entry and I am using a plugin called ‘Form_Helper’. It appears that the automatic generation of the title is conflicting with the editing of the page on submission. Is this something that you have come across?

  • #7 / Mar 25, 2010 5:38am

    I don’t use the Form_Helper plugin, so not sure where the conflict arises.

    I always give users (that are allowed to publish or edit) access to the EE control panel.
    It always seems better to use a method that has had a lot of thought go into its design rather than me hack something together. But I don’t have a problem revealing that EE is being used, so don’t need to hide it.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases