https://apex.oracle.com/pls/apex/f?p=134181:79
When the text area item contains a string with newlines (e.g. 1234\n5678) the behavior is a little strange
The character counter shows 10
The server side DA (length(:item)) shows 10
The server side DUMP shows 10 with CHR(13) and CHR(10)
Client side script apex.item(:item).getValue().length shows 9
Intuitively, #4 makes sense to me and I would expect #1 and #4 to match since they are client side values.
Questions
What is going on here?
How can I add a server side validation to restrict the length to X characters using client side semantics i.e. using CR for newline instead of CR+LF
Setting up a simple example in sqlplus also shows the newline represented by CHR(10). So where exactly does APEX ACCEPT processing introduce the CHR(13)?!!
create table foo(s varchar2(10));
insert into foo(s) values ('1234
5678');
select s,length(s) l,dump(s) d from foo
@patrick-wolf-oracle
Thanks
Edit: Inspecting the XHR requests shows that itemsToSubmit sends a newline as \r\n instead of simply \n. Is this a bug? Can this behavior be changed?
{
"p_flow_id": "134181",
"p_flow_step_id": "79",
"p_instance": "9562125705508",
"p_debug": "",
"p_request": "PLUGIN=REEgVFlQRX5-MjQwMzg3MjQwNzg4OTYzNzQy/b9WwH-mRaJRMDBBMmMUJB6siUMNKIFftJz7Lb8rqPlrrKjsXFrpS7qKbw0-3ieuptnP1CAg0EC3FXja625bkaA",
"p_json": "{\"pageItems\":{\"itemsToSubmit\":[{\"n\":\"P79_TEXT\",\"v\":\"1234\\r\\n5678\"}],\"protected\":\"UDc5X0xFTkdUSDpQNzlfRFVNUDpQNzlfTEVOR1RIXzE6UDc5X0RVTVBfMQ/FHenCYgvpHMBQJhe2v-STPOXhhka5HeGR0QwdTEJa0ddtAr34d8WO_K_3dylZkAzhlXPmxAG9GLHup6qeeab0A\",\"rowVersion\":\"\",\"formRegionChecksums\":[]},\"salt\":\"238399275411624567538150413637297130171\"}"
}