PDA

View Full Version : Load record to form without hyperlink.



ragecf
5 Aug 2013, 1:51 AM
Hi all,

I want to load a grid record to form in order to edit it.

But some of record field value is hyperlink like "value (https://www.sencha.com/forum/xxx)"

I just want to load the raw value to form field without html symbol.

Please provide a function to handle this. thanks.



form.loadrecord(record);

julio.batista
5 Aug 2013, 4:24 AM
The cellclick's event (http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.grid.Panel-event-cellclick) fourth parameter is the record used to render the grid line.


onCellClick: function(grid, td, cellIndex, record)
{
form.loadRecord(record); // your code
}

ragecf
5 Aug 2013, 4:39 PM
The cellclick's event (http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.grid.Panel-event-cellclick) fourth parameter is the record used to render the grid line.


onCellClick: function(grid, td, cellIndex, record)
{
form.loadRecord(record); // your code
}



Sorry for my poor english.
I know how to load record to form.
I want to know how to remove the record html symbol.
For example:
A record data is aaa (https://www.sencha.com/forum/xxx), but I only want to load 'aaa' to form field, no aaa (https://www.sencha.com/forum/xxx).

julio.batista
6 Aug 2013, 3:14 AM
Sorry I misunderstood your question.
In this case, you should apply a regex to remove the HTML (At this moment I don't know another approach)


var text = record.get('htmlfield');
text = text.replace(/<\/?(\w|\s|=|')+>/gi, "");
record.set('htmlfield', text);
form.loadRecord(record);