Buy Now
Sign in

Textarea bug?

megana , December 29 2017
Answered
M
megana
Hi there, I am using CC6 and CF6. I have a connection with a Form view that is using {chronoform:FormName} to load my form. After some hunting through this forum, I figured out how to put {var:read_data2.Data2} into the Data Provider box so that my form will be pre-filled with the data from the connection Function.

However, I ran into a problem with a textarea.

The value for the textarea field should be:

<p>Test Intro</p>


But when I view the source of my form, this is what I see:

<textarea data-editor="1" data-autoresize="1" rows="10" name="intro" id="intro" value="<p><p>Test intro</p></textarea>


It's breaking the form so that it tries to put all the fields after the textarea into the textarea box too.

Help please!

EDIT: On a somewhat related note, I noticed that the Date fields also aren't filling in properly. I think this is because the values are in the wrong format from what the Date fields expect, but I can't figure out the correct location and syntax for reformatting the values. With CC5/CF5 I would just use PHP in a custom code box in the form's load event. If anyone has any advice on that...
admin
Hi megana,

Please attach a backup of the "form" only.

You can also try to insert "<p>Test Intro</p>" in the textarea content box, does it display correctly ?

Another solution is to use {var:read_data2.Data2.text_area_name} in the content box of the textarea.

But your current config should work and is working for me here!

Happy new year!

Best regards
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
M
megana
Hi Max,

Sure I have attached the form backup.

When filling out the form for a new entry, the textarea has a default "Content" value that includes several paragraphs with <p> tags and that all displays fine. I had changed it to "<p>Test Intro</p>" when testing the form and it submitted and saved to the database properly. It's only when editing that it doesn't fill in the textarea properly.

Thanks,
-Megan
Attachments
Manage_Questions_02_Jan_2018_10_06_42.cf6bak
(42.56 KiB)
41 Downloads/Views
admin
Hi Megan,

Since the problem is only when editing then I can not test it without a copy of the db table, or if you can give me access to the app page on your website ? you can send the link by PM if so.

The textarea with the problem is the one which has the wysiwyg editor ? if yes then did you try with the editor disabled ?

Best regards
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
M
megana
Hi Max,

Yes that's correct and I did try it with the WYSIWYG disabled but it had the same problem.

I'll send a PM with the info.

Thanks,
-Megan
M
megana
This probably isn't the best way to fix this, but here's what I tried for now.

In libraries/cegcore2/helpers/html.php, I found this section:

if($type == 'textarea'){
      $this->tag = 'textarea';
      $this->content = !empty($this->attributes['value']) ? $this->attributes['value'] : '';
      if(empty($this->attributes['data-rows'])){
        $this->attributes['data-rows'] = $this->attributes['rows'];
      }
    }


And changed it to this:

if($type == 'textarea'){
      $this->tag = 'textarea';
      $this->content = !empty($this->attributes['value']) ? $this->attributes['value'] : '';
      $this->attributes['value'] = '';
      if(empty($this->attributes['data-rows'])){
        $this->attributes['data-rows'] = $this->attributes['rows'];
      }
    }


Now my textarea is filled in properly but doesn't try to add an unnecessary "value" attribute.

Still trying to figure out this date issue:

On a somewhat related note, I noticed that the Date fields also aren't filling in properly. I think this is because the values are in the wrong format from what the Date fields expect, but I can't figure out the correct location and syntax for reformatting the values. With CC5/CF5 I would just use PHP in a custom code box in the form's load event. If anyone has any advice on that...
admin
Hi megana,
Thank you very much, I have applied the file to the next update!
What problem do you have with the date field at the moment ?
Best regards
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
M
megana
Thanks Max!!
For the dates, the problem is that I have the date field set to use the format mm/dd/yyyy, but it saves into the database in yyyy-mm-dd format. When I go to edit an entry, the date field doesn't populate. For now, I just changed the date field to use yyyy-mm-dd format and now it populates fine, but we have people get annoyed because it's not "easy to read".
admin
Hi megana,
The date field is in Chronoforms or Connectivity ? do you have the latest Chronoforms6 update ?
Best regards
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
M
megana
Hi Max,
Just got the latest update and it works now, thank you!!
-Megan