开发者

copy textfield value from one tabs to another tabs

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')" ?>/&g开发者_JS百科t;</td>
</tr>


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 !


 $("#model").change(function() {
                                 var barcode;   
                                 barCode=$("#model").val();
                                 var data=barCode.split(" ");
                                 $("#model").val(data[0]);
                                 $("#serial").val(data[1]);
                                 var str=data[0];
                                 var matches=str.match(/[T|EE|EJU].*D/i);


  $("#input").click(function() {
        if($("#submit").valid()) {
                var params=$("#submit").serialize();
                $.ajax({
                        type:"post",
                        url:"process1.php",
                        data:params,
                        cache :false, 
                        async :false,
                        success : function() {  
                                                $('#showline').val($('#line').val());
                                                $('#showmodel').val($('#model').val());
                                                $('#showNIK').val($('#id').val());
                                                $("#model").val("");
                                                $("#serial").val("");
                                                $("#line").val("");

i put freekOne code before set .val("");

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜