1

(3 replies, posted in Troubleshooting)

Hi Ed.
    I thought that some function is having a warning but if I comment any of the two registerFunction it works normally...
    I check more if I found it I let you know!
Regards,
Gui

2

(3 replies, posted in Troubleshooting)

Hi,
  I got the problem

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started
xajax5/xajax_core/plugin_layer/support/xajaxUserFunction.inc.php:191) in

  Today I'm registering 24 functions using $xajax->registerFunction
  If I comment any two entries it doesn't show it.
 
   Any idea what I'm missing?

Best Regards,
Guilherme Filho

3

(4 replies, posted in Getting started with xajax)

Dear Ed.
 
    Thank you for you help!
    Using the assign I could write
$resp->assign('ID_HTML_ITEM','dataset.NAME_DATASET_WANTED',$value);
     I got the dataset .(dot) name here:
https://developer.mozilla.org/en/docs/W … nt/dataset

Best Regards,
Guilherme Filho

4

(4 replies, posted in Getting started with xajax)

Hi,
 
   It's possible to define some data on html tags as DIV. You can write <div data-name="Guilherme" data-age="29">Some text</div>,
   Using javascript you can read and write these values (name/age).
   I would like to use xajax to write directly some values for these data-info items.

Best Regards,
Guilherme Filho

5

(4 replies, posted in Getting started with xajax)

Hi,

   Is there way to change a value of data-set directly by Xajax? I tried using assign function but noting happen.

   I'm using xjax 0.5.

   When I want change a data-set using javascript I normally use .setAttribute('data-nameset',new_value); 

  Should I use script function?

Best Regards,
Guilherme Filho

6

(24 replies, posted in Announcements)

Hi,
  I'm using with php 5.5.
  If you find any problem with php 5.6 please report so we can take a look.
  Also this (update) is something we could take a look to make updates on xajax.

Best Regards,
Guilherme

7

(24 replies, posted in Announcements)

I'm still here!

8

(7 replies, posted in PHP Help)

It's been a waste what I'm doing... I grouped the data to make it flat again... It'a much easier use the field choose by the user adding on the SQL query by "ORDER BY ".field_1,field_2..field_N;

So when I'm going to print I can check when the field change to print the information/sub-total of the group....

Sorry to bother you!

Just to let someone know, to flat the array it can be done using the function
$flat = call_user_func_array('array_merge', $array);

9

(7 replies, posted in PHP Help)

I'm thinking a way o convert this array to a single array creating a key as:
11-54-0= array(information)
11-55-0= array(information)
11-55-1= array(information)
1-56-0= array(information)
8-57-0= array(information)
8-57-1= array(information)
so I could with a simple foreach print...
probably a recursive function could let me do it....

10

(7 replies, posted in PHP Help)

Check where I'm:

For each (group_selected_by_user as $nomecampo)
{
    //I create a string doing
    $evalGrupo .= "[\$linha['".$nomecampo."']]";
}
The result is like like [$linha['cliente']][$linha['numeroos']]
So when I select the data I do:

while($linha = $result->fetch_assoc())
{
     eval('$dadosRelatorio'.$dadosLinha['agrupamento']['eval'].'[]=$linha;');
}

Now I have the follwing data:
$dadosRelatorio =>
Array
(
    [11] => Array
        (
            [54] => Array
                (
                    [0] => Array
                        (
                            [numeroos] => 54
                            [ret.1.2] => RM10002
                            [ret.1.3] => 2015-02-25
                            [ret.2.1] => 20
                            [ret.2.10] => Oficina - 54 - 1
                            [ret.2.12] =>
                            [ret.2.13] =>
                            [cliente] => 11
                        )
                )
            [55] => Array
                (
                    [0] => Array
                        (
                            [numeroos] => 55
                            [ret.1.2] => RM10002
                            [ret.1.3] => 2015-02-10
                            [ret.2.1] => 25
                            [ret.2.10] => Oficina - 55 - 1
                            [ret.2.12] =>
                            [ret.2.13] =>
                            [cliente] => 11
                        )
                    [1] => Array
                        (
                            [numeroos] => 55
                            [ret.1.2] => RM10002
                            [ret.1.3] => 2015-02-10
                            [ret.2.1] => 1
                            [ret.2.10] => Oficina - 55 - 2
                            [ret.2.12] =>
                            [ret.2.13] =>
                            [cliente] => 11
                        )
                )
        )
    [1] => Array
        (
            [56] => Array
                (
                    [0] => Array
                        (
                            [numeroos] => 56
                            [ret.1.2] => MIX5053
                            [ret.1.3] => 2015-03-05
                            [ret.2.1] =>
                            [ret.2.10] =>
                            [ret.2.12] =>
                            [ret.2.13] =>
                            [cliente] => 1
                        )
                )
        )
    [8] => Array
        (
            [57] => Array
                (
                    [0] => Array
                        (
                            [numeroos] => 57
                            [ret.1.2] => MIX5053
                            [ret.1.3] => 2015-03-05
                            [ret.2.1] => 100
                            [ret.2.10] => Oficina - 57 - 1
                            [ret.2.12] =>
                            [ret.2.13] =>
                            [cliente] => 8
                        )
                    [1] => Array
                        (
                            [numeroos] => 57
                            [ret.1.2] => MIX5053
                            [ret.1.3] => 2015-03-05
                            [ret.2.1] => 1
                            [ret.2.10] => Oficina - 57 - 2
                            [ret.2.12] =>
                            [ret.2.13] =>
                            [cliente] => 8
                        )
                )
        )
)

My next problem is how show this data, because in this case I have to have two:
foreach($array_1 as $result1)
    foreach($result1 as $result2)
       print information

But I can have more than two... or maybe less than 1.....

11

(7 replies, posted in PHP Help)

Hi.
  I'm letting the user group the data as they want. Try this: table = (ID, DAY, MONTH, YEAR, CLIENT, INFORMATION, TOTAL)
  Maybe the user wants to check the register grouped by DAY - MONTH ... so I need to create a array [DAY][MONTH] maybe he wants by [CLIENT][MONTH][YEAR]...
  Creating this array I will print the registers by the way the user wants...
  The solution I found on the internet is use eval... also I found this class: http://demos.diafol.org/generic-table-r … -array.php

  But I'm really not sure what is the best option...

12

(7 replies, posted in PHP Help)

Hi,

   Think if I have a table as (id, field1, field2, field3, field4, field5) and I need to create a array with the key choose by the user.
   The user1 wants: $valuelist['field1']['field3'] = $value_line;
   The user2 wants: $valuelist['field2']['field4']['field5'] = $value_line;

    After I will show to user1
     field1
        field3 = values
 
    And user 2 will get
     field2
        field4
            field5 = values   

     Any idea how to do it?
     I thought about a recursive function....
     I also thought making a "ORDER BY fields_choose_by_user" and when it changes the values from any key choose print....

Best Regards,
Guilherme Filho

Hi.
 
  Yes, I also don't think is possible but I think if we create something like this it would be nice, right? Because nowadays Class programming style is much common so it's interesting
   
  If you know something about it please let me know!

   Thank you again!
Best Regards,
Guilherme

Hi,

   Is it possible to call a function belonging a PHP class from Javascript?
 
   I think it can't be possible to call a non-static function but static function can?
   If no it would be nice to call, don't?

Best Regards,
Guilherme Filho

15

(6 replies, posted in Getting started with xajax)

Yes. I create a array (field_name => value)... so I do a $jSON = json_encode($array_created); and $objResposta->script('feedForm(\'formid\','.$jSONcampos.');');

My idea was feeding a form, so I just tought about fields with INPUT tag. I'm pretty sure DIVs can't have value... and we can't access DIV or SPAN by document.forms[formid][divname or id]... About the textarea I'm not sure if I should use .innerHTML or .value... maybe we should add something as if(typeof element == 'textarea') use innerHTML.

To feed the divs I had created a similar function but besides .value I use .innerHTM and besides (formId, fieldName) I use (className). So I read the .children from some specific DIV and compare each element.className with the className received if equal I print the value.

Guilherme Filho

16

(6 replies, posted in Getting started with xajax)

Hi Ed,
   Thank's for your help. I wrote the code bellow... not so big as I tought;

function feedForm(formid, formvalue)
{
    var form = document.getElementById(formid);
    if (form)
    {
        for(fieldname in formvalue)
        {
            if (document.forms[formid][fieldname])
            {
            document.forms[formid][fieldname].value = formvalue[fieldname];
            }
        }
    }
}

   It's working... just remember that the JSON just accept UTF8 values.

Best Regards,
Guilherme Filho

17

(6 replies, posted in Getting started with xajax)

Hi Ed.

    I have been working with XAJAX since 2007. Now my projects are too big, creating IDs for every field is getting hard to manage. I found much easier separate the fields by forms. Now I can have fields with the same meaning with the same name. On some pages there are more than one form and some times it has the same fields meaning.

    The json helped me to show the values for the users. Now I'm will feed the forms some forms. I will create some javascript to do it but maybe we can include this feature for the next version. I think it would be nice we can feed a form by the name using a native xajax's function.

    I haven't study XAJAX deeper to know how it seed and receives the data. Does it uses JSON to do it? I like to make the Javascript more light than possible. Do you think creating a native function for the feeding a form by form id, field name it will make the Javascript as big as some script I can develop?

Best Regards,
Guilherme Filho

18

(6 replies, posted in Getting started with xajax)

Hi,
 
   I have been work deeper with forms instead of IDs to get and set values. Because on bigger projects you should create to many IDs and take care of each is harder besides form.

   Does xajax has something:

$objResposta->assign(formname,fieldname,'value',newvalue);

?

Best Regards,
Guilherme Filho

Hi,
 
    Is it possible to get the data-* (http://www.javascriptkit.com/dhtmltutor … utes.shtml) information from fields and send together with the form values?

    I know I can do a Javascript script to retrieve these information, create a object or array and send. Is there some function already getting this information and adding to the form keys->values array?
   
    As been a custom attribute I'm not sure if Javascript can "discover"  the attributes.

Best Regards,
Guilherme Filho

Hey Ed,
   
   The solution I got is easier then do CAST or CONVERT. I just had to add:

$mysqi->set_charset("utf8");

   Before request the data... now is working fine with json.
 
   My data is still be saved on latin1.

 
Best Regards,
Guilherme

Hi,
  I don't think so, because when I use utf8_encode it works simply fine. I just don't want to wast processing time to every time convert each field using utf8_encode... I will try to create a view to see what happens.

   I let you know!
   Thanks again!
Guilherme Filho

Hi Ed,

   Thanks that is totally useful!

   I got a problem that my database(mysql) uses latin1_spanish_ci char coding. I tried to convert to UTF8 on mysql CONVERT(FIELD AS using utf8) but the json_encode didn't accept. So I had to list the field on PHP and do a utf8_encode.
   Do you know why the UTF8 conversion from mysql couldn't get right?

Best Regards,
Guilherme Filho

23

(6 replies, posted in General xajax Discussion)

Hey,

   Nice to hear from you!

   I'm also happy to help if I can.

Guilherme Filho

Hi.

   I would like to send some data as "php (array key=>value)" to the javascript.
   I want use javascript to feed some html tag, as DIV, with the values. I can't use ID on the divs because maybe I will have more than one DIV with the same value, both divs will have the same html CLASS, so I can with javascript do something like:

if(div.CLASS==key) div.innerHTML = value;

   I thought about create a formated string as "$key=>$value;$key2=>$value2;" and request ->script('functionaname($data)');
   On javascript I can data.split(';') and split again "=>"
   But I'm not sure if there is a limit size for parameters on Javascript, but I can also send the data to a not_display_div and call the function to read the innerHTML of this div and split and feed the others divs.

   I'm looking for something more good well coding!
   Ideas?

Best Regards,
Guilherme

When the user logs I create a SESSION['whatnameyouwant']. So when I got a a resquest I do isset(SESSION['whatnameyouwant']) if it's, it's ok if not has to login again.