www.webdeveloper.com
Results 1 to 2 of 2

Thread: Add new field Problem

Hybrid View

  1. #1
    Join Date
    Oct 2011
    Location
    Pakistan
    Posts
    16

    Add new field Problem

    hello out there i am having issue with the javascript click to add new fields
    Here i have a website field
    when a user would click add neew website field add new Link and and new keywords field also come with
    this a website has multiple URL links and keywords so this become three dimensional array

    I have used

    <input type="text" name="website[]" value="">

    for the website field and for the Link url field

    <input type="text" name="links[0][]" value="">

    Where [0] is the value of website

    and then for the keywords i have used

    <input type="text" name="keyword[0][]" value="">

    where [0] is the value of the link url and here is the whole javascript codde i am using to add new fields on click

    function add_more_comp(id){
    var next_row = id+1;
    var new_url_feild = '<table width="100%" ><tr><td width="29%" valign="top"><label>Link Url : </label></td><td width="71%"><input type="text" name="links['+id+'][]"></td></tr><tr><td valign="top"><label>Keywords : </label></td><td><input type="text" name="keyword['+id+'][]"><div id="more_img'+id+'"></div><span align="right" style="width:400px; font-size:12px; text-align:right;" id="add_more_video_btn_3"><a href="javaScript:void(0)" onclick="add_keywords('+id+')">Add Keywords....</a></span></td></tr></table><span align="right" style="width:400px; font-size:12px; text-align:right;" id="add_more_video_btn_1"><a href="javaScript:void(0)" onClick="add_more_comp('+next_row+')">Add Links....</a></span></td></tr></table><div id="more_imgs'+next_row+'">';

    $("#more_imgs"+id).append(new_url_feild);
    $('#add_more_video_btn_1').html('<a href="javaScript:void(0)" onclick="add_more_comp('+next_row+')">Add More Links....</a>');
    }

    function add_more_keywords(id){
    var next_row = id+1;
    var new_url_feild = '<input type="text" name="keyword[0][]" style="margin-top:5px;">';

    $('#more_img_2').append(new_url_feild);
    $('#add_more_video_btn_2').html('<a href="javaScript:void(0)" onclick="add_more_keywords('+next_row+')">Add More Keywords....</a>');
    }
    function add_keywords(id){
    var next_row = id+1;
    var new_url_feild = '<input type="text" name="keyword['+id+'][]" style="margin-top:5px;">';
    $("#more_img"+id).append(new_url_feild);
    $('#add_more_video_btn_3').html('<a href="javaScript:void(0)" onclick="add_keywords('+id+')">Add New Keywords....</a>');
    }

    function add_website(id){
    var next_row = id+1;
    var new_url_feild = '<div class="wrapper_div"><table width="100%" ><tr><td width="29%" valign="top"><label>Website : </label></td><td width="71%"><input type="text" name="website[]"></td></tr><tr><td width="29%" valign="top"><label>Link Url : </label></td><td width="71%"><input type="text" name="links['+next_row+'][]"></td></tr><tr><td valign="top"><label>Keywords : </label></td><td><input type="text" name="keyword['+next_row+'][]"><div id="more_img'+next_row+'"></div><span align="right" style="width:400px; font-size:12px; text-align:right;" id="add_more_video_btn_3"><a href="javaScript:void(0)" onclick="add_keywords('+next_row+')">Add Keywords....</a></span><br><span align="right" style="width:400px; font-size:12px; text-align:right;" id="add_more_video_btn_1"><a href="javaScript:void(0)" onClick="add_more_comp('+next_row+')">Add Links....</a></span></td></tr></table><div id="more_imgs'+next_row+'"></div></span></td></tr></table></div>';
    $("#more_img_4").append(new_url_feild);
    $('#add_more_video_btn_4').html('<a href="javaScript:void(0)" onclick="add_website('+next_row+')">Add More website....</a>');
    }

    andd here is the link http://urgetech.com/worker/add_link2.php for the page can any body please please help me how to sort this out

  2. #2
    Join Date
    Oct 2011
    Location
    Pakistan
    Posts
    16
    waiting any one please ans

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles