No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    WYSIWYG q-editor lazy rules

    Help
    3
    4
    672
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G
      Gorgc last edited by

      How can i make :rules for q-editor to validate that it cannot be empty?

      S 1 Reply Last reply Reply Quote 0
      • S
        suleiman_as @Gorgc last edited by

        @gorgc I don’t think it has rules like text inputs, but you can always validate the value yourself.

        1 Reply Last reply Reply Quote 0
        • Lurrik
          Lurrik last edited by Lurrik

          Hi @Gorgc,

          It’s not beauty, but that’s works :

          TEMPLATE

          <div>
                     <i
                      aria-hidden="true"
                      v-show="showWarning"
                     role="presentation"
                     class="absolute-top-right q-pt-xs q-pr-sm material-icons q-icon notranslate text-negative"
                    style="font-size: 25px"
                     >error</i>
          
                     <q-editor
                      v-model="message"
                      :style="styleWYSIWYG"
                      @blur="checkMessage"
                      :toolbar="[
                       // Your config
                      ]"
                      :fonts="{
                       // Your config
                      }"
                    />
           </div>
          

          SCRIPT

          export default {
            name: "",
            data() {
              return {
                message : "",
                styleWYSIWYG:  "border: 1px solid;border-color: #D1CDC8;border-radius:5px;",
                styleWarningWYSIWYG: "border: 2px solid;border-color: #C10015;border-radius:5px;",
                styleBasicWYSIWYG: "border: 1px solid;border-color: #D1CDC8;border-radius:5px;",
                showWarning: false,
              };
            },
          methods: {
              checkMessage() {
                if (this.message == "") {
                  this.styleWYSIWYG = this.styleWarningWYSIWYG;
                  this.showWarning = true;
                } else {
                  this.styleWYSIWYG = this.styleBasicWYSIWYG;
                  this.showWarning = false;
                }
              },
           }
          }
          
          1 Reply Last reply Reply Quote 1
          • G
            Gorgc last edited by

            Wah thanks guys

            1 Reply Last reply Reply Quote 0
            • First post
              Last post