WordPress.org

Ready to get started?Download WordPress

Forums

Running javascript in php foreach (1 post)

  1. adige72
    Member
    Posted 2 years ago #

    Hello

    Firstly, this is the full pastebin code of my admin page because i failed adding full code here correctly: http://pastebin.com/tQAaQjYC

    and the screenshot of the slide manager page:
    http://img36.imageshack.us/img36/4830/slidemanager.jpg

    Well, I have a Slide Manager as an admin menu page in WordPress. When i click "Add new slide" button, as you see in the screenshot above, it adds a new "slide field" in which that dropdown list shows all titles of posts. (Ignore other parts as they work as expected)

    What i would like to do is, when i choose a post title, the text box which is next to dropdown to be populated automatically by the post's url adress. I want it to be worked for every "slide field" added via "Add new slide" button.

    I actually made it work that way outside the foreach:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Each slide field shows the dropdown and text box properly as you see in screenshot BUT none of them work.

    I tried to add brackets but it didn't work either:

    <select name="link[]" onChange="onChange(this.value);">

    I guess it's the javascript code that should be edited or entirely changed but i have no idea how to do it.

    I would be grateful for any help. Thanks in advance.

Topic Closed

This topic has been closed to new replies.

About this Topic