3

I was playing few days with Webix, but I don't have enough experience with it, so need sme help.

What I need: Create simple page with textarea and button. When I press button, it takes data entered in textarea and saves it in N's string in the data/data.php file.

This is what I could do so far:

<!DOCTYPE html>
<html>
<head>
<title>Loading from DB</title>
<link rel="stylesheet" href="C:/__OSS/00. Soft/Webix/codebase/webix.css" type="text/css">
<script src="C:/__OSS/00. Soft/Webix/codebase/webix.js" type="text/javascript"></script>
</head>
<body>

<!--<?php
$filename = getcwd() . "data/data.php";
echo $filename;
$line_i_am_looking_for = 5;
$lines = file( $filename , FILE_IGNORE_NEW_LINES );
$lines[$line_i_am_looking_for] = '6my modified line';
file_put_contents( $filename , implode( "\n", $lines ) );
?>-->

<div class='header_comment'>Test Button</div>
<div id="testB" style='height:600px'></div>
<hr>
<script type="text/javascript" charset="utf-8">

        webix.ready(function(){


          gridb = webix.ui({
                                container:"testB",
                 "view": "form",
  "elements": [
    {
      "view": "textarea",
      "name": "woNumber",
      "id": "textarea",
      "label": "",
      "width": 300,
      "height": 200,
      "options": [
        "onViewResize"
      ],
      "value": "",
      "placeholder": "WO number (separate with comma if several)",
      "labelPosition": "top"
    },
    {
      "view": "button",
      "name": "getWODetails",
      "label": "",
      "value": "Submit",
      "options": [
        "autowidth:true"
      ],
                on:{
                    onItemClick:function(id){
                        webix.message("Sikim BLEAT'!!!");

/*                  onItemClick: getTextareaData;
*/
                    }
                },
      "labelPosition": "top"

    },
    {
      "view": "button",
      "id": "button1",
      "name": "getWODetails",
      "label": "",
      "value": "Passss",
      "options": [
        "autowidth:true"
      ],
                                on:{
                                        onItemClick:function(){
                                                webix.message("Values of textarea is "+$$('textarea').getValue());
                                     }
                                },
      "labelPosition": "top"

    }

  ]
                        });     
        });

        </script>
</body>
</html>

So I can get value from textarea with $$('textarea').getValue()), but have no idea how to write it in the file. I can do it easily with PHP (commented out part) but don't know how to make it works with Webix. I believe it is not so hard, but can't figure out what to do..

Any help highly appreaciated.

Roman
  • 107
  • 6

0 Answers0