7 Replies - 173 Views - Last Post: 09 January 2018 - 08:47 AM Rate Topic: -----

#1 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4212
  • View blog
  • Posts: 13,305
  • Joined: 08-June 10

How to handle textblock objects?

Posted 09 January 2018 - 02:04 AM

Hi,

sorry for the heading being a bit confusing. Heres what I have to do: I have a text block from an XML document that contains one line per (XML) sub element, essentially translating into a PHP array but held in a PHP object. This objects implements the ArrayAccess interface (since the base data is an array).

Now the question is whether to allow modifying/deleting a specific line/array element, ignore the modification with a PHP warning, or throw an exception (modification may lead to the text being distorted or changed in meaning).

Regards, Dormilich

PS. feel free to ask about the further background, if necessary.

Is This A Good Question/Topic? 0
  • +

Replies To: How to handle textblock objects?

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14244
  • View blog
  • Posts: 57,144
  • Joined: 12-June 08

Re: How to handle textblock objects?

Posted 09 January 2018 - 07:50 AM

A few things on how this will be used.. First off - is it supposed to be allowed to be edited? If not with the box then what control?
Was This Post Helpful? 0
  • +
  • -

#3 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4212
  • View blog
  • Posts: 13,305
  • Joined: 08-June 10

Re: How to handle textblock objects?

Posted 09 January 2018 - 08:34 AM

View Postmodi123_1, on 09 January 2018 - 03:50 PM, said:

First off - is it supposed to be allowed to be edited?

it's allowed to set or reset all content at once and it's allowed to append text. but whether it should be possible to modify a single line (which may not be a full sentence) ... I'm not sure if that's a good idea.
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14244
  • View blog
  • Posts: 57,144
  • Joined: 12-June 08

Re: How to handle textblock objects?

Posted 09 January 2018 - 08:37 AM

Yeah that's a large amount of wiggle room for things to go south. I would opt to lock it down.
Was This Post Helpful? 0
  • +
  • -

#5 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4212
  • View blog
  • Posts: 13,305
  • Joined: 08-June 10

Re: How to handle textblock objects?

Posted 09 January 2018 - 08:40 AM

View Postmodi123_1, on 09 January 2018 - 04:37 PM, said:

I would opt to lock it down.

Ok, then it remains to decide how (or if at all) to notify the user about the invalid action. I could go silent (no notification), emit a warning (and ignore the action), or throw an exception ...
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14244
  • View blog
  • Posts: 57,144
  • Joined: 12-June 08

Re: How to handle textblock objects?

Posted 09 January 2018 - 08:41 AM

Can you make it 'read only'? The universal sign to users to "no touchie da shiny thing".
Was This Post Helpful? 0
  • +
  • -

#7 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4212
  • View blog
  • Posts: 13,305
  • Joined: 08-June 10

Re: How to handle textblock objects?

Posted 09 January 2018 - 08:46 AM

View Postmodi123_1, on 09 January 2018 - 04:41 PM, said:

Can you make it 'read only'?

I don't think that would make much sense. The text block is used to represent a comment, address, or just arbitrary block text.
Was This Post Helpful? 0
  • +
  • -

#8 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14244
  • View blog
  • Posts: 57,144
  • Joined: 12-June 08

Re: How to handle textblock objects?

Posted 09 January 2018 - 08:47 AM

Ah yes.. sorry I was thinking 'multi line text area'.. eesh. I need a nap.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1