Bug #23053 Bug Fixed

liveUrlTitle() works only on the first form on a page. If two or more forms, it doesn’t work on the others.

Version: 3.5.5 Reporter: SChristy

To re-create, set up a simple template with two forms on it, both using the

onkeyup="liveUrlTitle();"

function. Only the first form will work. On the second, the liveUrlTitle() function will use the data from the first form but not put it anywhere. This is because the liveUrlTitle() function is set up at the document level instead of at the form level. The expected outcome is that both would work.

Here is my sample code:

<div class="well">
      {exp:channel:form channel="homepage_videos" include_jquery="no" return="/"}
     <div>
      <label for="title">Title:</label>
      <input name="title" type="text" id="title" maxlength="100" >
      <input type="hidden" name="url_title" id="url_title" value="{url_title}" maxlength="75" size="50">
       
      <label for="video_file">Embed code for chosen video:</label>
      {field:video_embed}
      <button type="submit" name="submit" class="btn btn-primary btn-success">Submit</button>
     </div>
      {/exp:channel:form}
    </div>

    <div class="well">
      {exp:channel:form channel="homepage" include_jquery="no" return="/"}
     <div>
      <label for="title">Title:</label>
      <input name="title" type="text" id="title" maxlength="100" >
      <input type="hidden" name="url_title" id="url_title" value="{url_title}" maxlength="75" size="50">
       
      {field:body_field}
      <label for="news_image">Image for post header:</label>
      {field:news_image}
                        <button type="submit" name="submit" class="btn btn-primary btn-success">Submit</button>
     </div>
      {/exp:channel:form}
    </div>

My current work-around is to set up my own JS code to handle the second form instance. However, it would be better if the liveUrlTitle() function was connected to the form, not the document.

  • Sorry for the trouble. We’ll have this fixed in the next release, but you’ll need to update your templates slightly. Just replace this:

    onkeyup="liveUrlTitle();"

    With this:

    onkeyup="liveUrlTitle(event);"
    Kevin Cupp
    01st May, 2017 at 3:36pm
  • Ok. I’ll try it. Thanks!

    SChristy
    01st May, 2017 at 6:48pm

You must be signed in to comment on a bug report.

ExpressionEngine News

#eecms, #events, #releases