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 549791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:13:14+00:00 2026-05-13T11:13:14+00:00

I have a jqGrid with say user information which is to be edited in

  • 0

I have a jqGrid with say user information which is to be edited in a form. The username is immutable but should appear in the form so the user is aware which user they are editing. The password is edit only. So in my colModel I have settings like this:

{name:'username', index:'username', width:155, editable:true, editoptions: {readonly:'readonly'}}, 
{name:'password', index:'password', width:155, hidden:true, editable: true, edittype:'password', editrules:{edithidden:true}}, 

This works fine for edit. My problem is on add I need to make the username ‘not readonly’. I don’t see properties to control the add form vs the edit form. Perhaps I can use the afterShowForm event to change the editoptions? Has anybody done anything like this?

  • 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-13T11:13:14+00:00Added an answer on May 13, 2026 at 11:13 am

    In case it is useful to anybody else, I wasn’t able to do this exactly but found a way to accomplish the end result.

    So instead of using editoptions to set the form field to readonly I used the beforeShowForm event of the add & edit options to add and or remove the readonly attribute.

    So the colmodel without the readonly:

    {name:'username', index:'username', width:155, editable:true}, 
    {name:'password', index:'password', width:155, hidden:true, editable: true, edittype:'password', editrules:{edithidden:true}}, 
    

    and the navGrid edit & add options to turn the readonly on (for add) or off (for edit). Note, the INPUT tag’s ID will be the value of the name field in the colModel:

    jQuery("#user-grid").jqGrid('navGrid','#user-grid-pager',
        { }, //options
        { // edit options
            beforeShowForm: function(frm) { 
                $('#username').attr('readonly','readonly'); 
            }
        }, 
        { // add options
            beforeShowForm: function(frm) { 
                $('#username').removeAttr('readonly'); 
            }
        }, 
        { }, // del options
        { } // search options
    );
    

    On a side note, while I know (according to jquery dump) the ‘frm’ function arg is a jQuery object containing the form, I could not get a selector to successfully select the child I wanted so I just used the id which matches the colModel name.

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

Sidebar

Related Questions

Is possible to have additional fields in jqgrid form? Say perhaps additional datepicker or
I have a jqGrid on which clicking of a row should render a partial
i have jqgrid in form , i want when user click in row this
I have a jqGrid with which users will select records. A large number of
in my jqgrid i have field in a table which represents the id and
I have some data from JQGrid that should be exported to excel. So, we
I have a jqGrid that has add/edit dialogs with a form that's longer than
I have a JQGrid plugin in my website, the table is loading OK, but
I have a Jqgrid which has datatype as local. I am loading data at
I have a jqGrid which when a row is selected, a jQuery UI modal

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.