Submitting Text area values with double quotes ""

3 posts, 1 answers
  1. Paul Grothe
    Paul Grothe avatar
    26 posts
    Member since:
    Apr 2010

    Posted 09 Dec 2014 Link to this post

    I have the grid defined below.  I need to be able to edit the Flag Notes column and post it back.  I have so far come up with 2 solutions that are close but don't quite fit the bill.  

    #1 gives a textarea to edit in, and it works exactly how it should, except the textarea is always visible and not just when you click in the cell to edit it.  
    #2 also works, it hides the text box until you click in it, and it will save the text entered.  The problem comes when double quotes are entered into the field.  then the text that is saved ends with the 'closing' ".  How do I get it to accept both single and double quotes?

    #2 is really what we want with the added bonus of actually being able to save double quotes or at least prevent them, maybe replace them with singles

    <div id="divSearchResults">
           .Editable(ed => ed.Mode(GridEditMode.InCell))
           .Scrollable(a => a.Height("auto"))
           .DataSource(ds => ds.Ajax()
               .Sort(sort => sort.Add("Name").Ascending())
               .Update(update => update.Action("SaveFlagComments", "Reports"))
               .Model(mod =>
                       mod.Id(m => m.ID);
                       mod.Field(p => p.Zone).Editable(false);
                       mod.Field(p => p.Name).Editable(false);
                       mod.Field(p => p.CarrierCode).Editable(false);
                       mod.Field(p => p.Location).Editable(false);
                       mod.Field(p => p.DispatchPhone).Editable(false);
                       mod.Field(p => p.DispatchFax).Editable(false);
                       mod.Field(p => p.DispatchEmail).Editable(false);
           .Columns(columns =>
                       .ClientTemplate("<input type='checkbox' " + ViewBag.disable + 
                       "#= Contacted ? checked='checked':'' # class='chkbx' value='#= ID#' name='selectCarrier' />" +
                       "<input type='hidden' value='#= ID#' name='allCarriers' />")
               columns.Bound(p => p.Zone).Filterable(false).Width(70);
               columns.Bound(p => p.Name).Filterable(false).Width(75);
               columns.Bound(p => p.CarrierCode).Filterable(false).Width(65);
               columns.Bound(p => p.Location).Filterable(false).Width(80);
               columns.Bound(p => p.DispatchPhone).Filterable(false).Width(70);
               columns.Bound(p => p.DispatchFax).Filterable(false).Width(70);
               columns.Bound(p => p.DispatchEmail).Filterable(false).Width(90);
                   .ClientTemplate(" <a href='" + Url.Action("Edit", "CarrierView", new { ID = "#=ID#" }) + "', target = '_blank' >Edit</a>").Width(30);
               columns.Bound(p => p.FlagNotes)
     #1              //.ClientTemplate("<textarea name='FlagNotes_#= ID#' cols='60' rows='3' style='height=100px'>#=FlagNotes#</textarea>")
     #2              .ClientTemplate("#=FlagNotes#<input type='hidden' name='FlagNotes_#= ID#' value=\"#=FlagNotes#\">")
              // columns.Command(command => { command.Edit();}).Width(40);

  2. Answer
    Daniel avatar
    2231 posts

    Posted 11 Dec 2014 Link to this post

    Hello Paul,

    Are you submitting the hidden input values? If yes, then you should encode the value set to the input in order to avoid the problem e.g.
    .ClientTemplate("#=FlagNotes#<input type='hidden' name='FlagNotes_#= ID#' value=\"#:FlagNotes#\">")


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. Paul Grothe
    Paul Grothe avatar
    26 posts
    Member since:
    Apr 2010

    Posted 11 Dec 2014 in reply to Daniel Link to this post

    Thanks, that was what was needed.
Back to Top