1 (edited by gui_calabria 2014-07-25 3:53:51 AM)

Topic: Get data-* (custom data attributes) information

    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

Re: Get data-* (custom data attributes) information

Afraid there's no function in xajax to retrieve the data attributes.

If I were wanting to do this I would probable do a javascript to handle the form values and create the data attribute array snd send it to the xajax function with 2 parameters.

function sendWithAttributes()
  var fields= xajax.getFormValues('myform');
  var dataAttributes = new array();

  //Now use the getAttribute() function as referenced in your linktojavascriptkit.com adding the key/value pairs to the dataAttributes array.

I would probably assign a class to each of the form fields (same for each one) and use a jQuery function to pass over the fields getting the data as I go.

  //Now send the vals to your xajax function 
  xajax_myXajaxFunction(fields, dataAttributes);


If you ever stop learning you may as well dig a hole, crawl in and pull the top over yourself.