Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6802829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:16:13+00:00 2026-05-26T19:16:13+00:00

While both autocomplete and select in jqgrid editform place the selected label into the

  • 0

While both autocomplete and select in jqgrid editform place the selected label into the cell, select will place the value (id) in the postdata array where autocomplete will place the label into the postdata array.

is there a way to get the editoption’s autocomplete to post the item value (id) instead of the label?

here is the jqgrid code segment i’m using autocomplete in…

$('#tab3-grid').jqGrid({
   colNames:['Workorder', 'wo.CUID',.....],
   colModel:[  
      .
      .
      .  
      {name:'wo.CUID', index:'cu.LastName', width:120, fixed:true, align:'center', sortable:true, editable:true, edittype:'text',
         editoptions:{dataInit:function(el){$(el).autocomplete({ source: 'php/customer-ac-script.php' 
                                                              , minLength: 1

                                                             })
                                          }
                    },
         formoptions:{rowpos: 1, label:'Customer', elmprefix:'* '},
         editrules:{required:true}
      },
      .
      .
      .
$('#tab3-grid').jqGrid('navGrid', '#tab3-pager',
   {view:true, closeOnEscape:true, cloneToTop:true}, // general parameters that apply to all navigation options below.
   {jqModal:true, navkeys:[true,38,40], savekey:[true,13]}, // edit options.
   {jqModal:true, navkeys:[true,38,40], savekey:[true,13], reloadAfterSubmit:false, afterSubmit: addRecordID}, // add options.
   {jqModal:true, afterSubmit: serverMessage}, // del options.
   {jqModal:true}, // search options.
   {jqModal:true, navkeys:[true,38,40]} // view options.
);

The php code segment:

// construct autocomplete select.
$i = 0;

while($row = mysql_fetch_assoc($result)) {
   $output[$i][$crudConfig['id']]    = $row['CUID'];
   $output[$i][$crudConfig['value']] = $row['LastName'];
   logMsg(__LINE__,'I','cu.CUID: '.$row['CUID'].', cu.LastName: '.$row['LastName']);

   $i++;
}

// encode to json format and send output back to jqGrid table.
echo json_encode($output);
logMsg(__LINE__,'I','Send json output back to jqGrid table: '.json_encode($output));

Would it be as simple as calling a function under the autocomplete select event or the grid before or after editform submit?

Also, i noticed this note in the jqgrid doc’s for datainit: that says…

Note: Some plugins require the position of the element in the DOM and
since this event is raised before inserting the element into the DOM
you can use a setTimeout function to accomplish the desired action.

Would the lack of including the settimeout function be causing the problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T19:16:13+00:00Added an answer on May 26, 2026 at 7:16 pm

    The server code which provide the JSON response on the autocomplete request has id and value properties. On the other side the standard behavior of jQuery UI Autocomplete is to use label and value properties (see “Datamodel” in the documentation). The value of label property (if any exist) will be used to display in the contextmenu. The value of value property will be placed in the <input> field after the user choose the item from the contextmenu. The value of label property can has HTML markup, but the value of value property must be the text.

    So I see the problem as pure problem of the usage of jQuery UI Autocomplete independent on jqGrid. If I understand correct your question you can solve your problem by modification your server side code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While editing an aspx file I found both these opening tags used for seemingly
After working for a while developing games, I've been exposed to both variable frame
I have two begininer programs, both using the 'while' function, one works correctly, and
I've been doing ASP.NET development for a little while now, and I've used both
This is something I've pondered over for a while, as I've seen both used
I tried: mb_strlen('普通话'); strlen('普通话'); both of them output 9,while in fact there are only
Can a SPID be used by two connections, while both connections are open? If
When I set a ManytoOne mapping, while both class in same namespace, it works.
I would like to thread some Javascript code while both the main process and
I've been using WxPython and I've tried Tk, but it seems that, while both

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.