doujiao9426 2010-06-24 09:13
浏览 25
已采纳

将文本字段值从一个选项卡复制到另一个选项卡

i'm using jquery tabs.. i'm use tabs-1 as input form and tabs-2 as show input data... i want after submit..all value inside textfield which have been type at tabs-1 can copy into textfield at tabs-2...

where part that i must modify?at form or at process page?what's code that can make it works?

 <script type="text/javascript">
        $(document).ready(function() {

         $("#input").click(function() {
        if($("#submit").valid()) {
                var params=$("#submit").serialize();
                $.ajax({
                        type:"post",
                        url:"process1.php",
                        data:params,
                        cache :false, 
                        async :false,
                        success : function() {  

that is for submitting form inside tabs-1...at tabs-2:

<tr>
    <td width="100"><input type="text" id="showline" name="showline"<? echo "$_postVar('line')" ?>/></td>
    <td width="100"><input type="text" id="showmodel" name="showmodel"<? echo "$_postVar('model')" ?>/></td>
    <td width="100"><input type="text" id="showNIK" name="showNIK"<? echo "$_postVar('id')" ?>/></td>
</tr>
  • 写回答

2条回答 默认 最新

  • doumi9618 2010-06-24 10:29
    关注

    Well, if I understand this correctly, you can use the callback on the AJAX function to do that (so that the submitted info is only displayed if the request was successful):

    [...]
    success : function() {
        $('#showline').val($('#faline').val());
        $('#showmodel').val($('#modelnm').val());
        $('#showNIK').val($('#NIK').val());
    };
    [...]
    

    assuming that #faline, #modelnm and #NIK are the IDs of the input fields in the form from which the data is being submitted.

    Also, in the HTML you don't need to echo anything anymore (which has incorrect syntax - it would be value="<? echo ... ?>" anyways) since the values will be added by jQuery.

    Hope this helps !

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?