Hello Friends I am trying to check or print the component values after the saving event is triggered.
I want to check on each component save. User added the www.blahblh.com URL or not then take action as per URL I am getting.
public void ComponentSaveAction(Component subject, SaveEventArgs args, EventPhases phase)
{
Component comp = subject;
string str = comp.Content.Value; // in str values getting empty
}
updated code.
public void ComponentSaveAction(Component subject, SaveEventArgs args, EventPhases phase)
{
ItemFields fields = new ItemFields(component.Content, component.Schema);
foreach (var items in fields)
{
if(items.ToString().Contains("www.blahblah.com"))
{
//throw pop up exception
}
else{
//save logic
}
}
}
Using this code i am able to check the component field contain the url or not. Bur problem is its work only for textfield. How to read the data if component field contain EmbeddedSchemaField,ComponentLinkField. Any solution to catch this all filed in parent node level and read as string ?
Thanks in advance :)