Can't insert text into CKEditor - ckeditor

I am trying to insert text into CKEditor and looks like it's not working.
<textarea name="editor2" class="form-control" id="announcementEditBody" rows="3" placeholder="Enter ..."></textarea>
CKEDITOR.replace('editor2');
$('editor2').val(response['aBody']);
Neither does CKEDITOR.instances.editor2.setData(); work, neither .insertText neither ['editor2'], it gives me this error Unable to get property 'setData' of undefined or null reference.

In CKEditor documentation they wrote about use of ID, so try to set data this way -
CKEDITOR.instances.announcementEditBody.setData();
OR
CKEDITOR.instances['announcementEditBody'].setData();

Related

vee-validate error message don't have the field name

I am trying to get a hand of vee-validate 3. A lot has changed on version 3.
Problem is the error messages do not have the specific field name. Below is the code that i have in a laravel blade file:
<validation-provider rules="email" v-slot="{ errors }">
<input type="text"
class="input"
name="email"
v-model="email">
<span>#{{ errors[0] }}</span>
</validation-provider>
When i strart typing in the input field, the error message prints inside the span tags, but it does not have the field name, rather a generic 'field', such as below:
{field} is not valid.
Anybody knows how to get this working?
Thanks,
I found it in the docs. All you need to do is add a name property to the validation-provider component like below:
<validation-provider rules="email" name="...add_input_field_name_here..." v-slot="{ errors }">

How to set tabindex attribute

When using Binding.scala, I can not write html that uses the tabindex attribute.
Is this a bug in Binding.scala / scala.js?
<div>
<input tabindex="1"></input>
<input tabindex="3"></input>
<br></br>
<input tabindex="2"></input>
<input tabindex="4"></input>
</div>
Results in compile error:
ScalaFiddle.scala:12: error: value tabindex is not a member of scalajs.this.dom.html.Input
ScalaFiddle.scala:13: error: value tabindex is not a member of scalajs.this.dom.html.Input
ScalaFiddle.scala:15: error: value tabindex is not a member of scalajs.this.dom.html.Input
ScalaFiddle.scala:16: error: value tabindex is not a member of scalajs.this.dom.html.Input
I tried to use the attribute (or property?) tabIndex, but it is not a string and the attribute argument needs to be a string.
For example see this: https://scalafiddle.io/sf/kDg2uAA/0
I am quite new to scala, sbt and scala.js, so I am not sure where/how to fix this and how to test a fix locally before creating a pullrequest.
You can use the tabIndex attribute with a value enclosed in {} (tip: you can use any scala code inside!).
<div>
<input tabIndex={1}></input>
<input tabIndex={3}></input>
<br></br>
<input tabIndex={2}></input>
<input tabIndex={4}></input>
</div>
Please, see a full code here: https://scalafiddle.io/sf/hGkAVib/1
You need to use the data:tabindex property. Please see https://scalafiddle.io/sf/TlcSdfF/1

Update ng-repeat value with ng-model

<input type="text" ng-repeat="board in allBoards track by $index" ng-model="board">
✔
What I am trying to do is modifying board name with UpdateBoards(). But I click the button, values of the input are not passed to UpdateBoards, what should I change? Thanks
So for I understand your problem try following:
<div ng-repeat="board in allBoards track by $index">
<input type="text" ng-model="board">
✔
</div>
By wrapping ng-repeat in div and calling each input and a href tag inside div, hope it will help you.

Adding value in input text field using Rails 3

I have a small problem.I want to add value inside the input text field which is fetching from DB.
Suppose i have a input field like below.
<input type="text" class="form-control" placeholder="Receipt No">
I have to add #user.Receipt_No inside it as its value.This value is fetching from user table of DB.Please help me resolve this problem.
Try this,
<input type="text" class="form-control" placeholder="Receipt No" value="<%= #user.Receipt_No %>">

How do I automate a page whose id keeps changing but the title remains the same?

We have a web application which has a list of reports, which I am trying to automate.
There is an option to view all these reports. When I open a report to view, there are some values I need to select to view it, which is where I am stuck.
The id used for these reports are generic. If the id for <label>Application<lable> is <select id="id1" name="id[1]" class="valid">, the same label in a different report will have a different id. How do I proceed from here?
Giving the tags of two sample reports:
First report:
<div>
<label id="PackageID">
Package ID <span class="required">*</span></label>
<input id="id_1__Name" name="id[1].Name" type="hidden" value="PackageID">
<select id="id_1__SelectedValues" name="id[1].SelectedValues" class="valid">
</div>
Second report:
<div>
<label id="PackageID">
Package ID <span class="required">*</span></label>
<input id="id_5__Name" name="id[5].Name" type="hidden" value="PackageID">
<select id="id_5__SelectedValues" name="id[5].SelectedValues" class="valid">
</div>
Not sure if this suggestion is suitable for your scenario, but you could get the id with jQuery and store it in a hidden field:
var id = $('.className').attr('id');
or use control's ClientID property.
Anyway, to select proper value you just need
#browser.select_list(:id, "id_5__SelectedValues").set("3")

Resources