FoxInCloud
Reading html content
Gravatar is a globally recognized avatar based on your email address. Reading html content
  Michele
  All
  Jan 8, 2021 @ 05:58am

I hava a form with a oie control in it where i show (and edit) an html file. I have a button that let me to save the html and its content (what i edit in input or checkboxes)

The code i use is this

Lparameters tcHtml

If Thisform.wlHTMLgen
	Local cJS
	TEXT to cJS textmerge noshow flags 1 pretext 3
   var $doc = jQuery(jQuery('#<<this.parent._oleIE1.wcID>>').prop('contentDocument').documentElement)
   $doc.find('input').each(function(idx,inp){
    var $inp = jQuery(inp);
    $inp.attr('value', $inp.val());
   });
   
$doc.find('input').each(function(idx,inp){
    var $inp = jQuery(inp);
    $inp.attr('value', $inp.val());
   }).filter('[type=checkbox]').each(function(idx,chk){
    var $chk = jQuery(chk);
    if ($chk.prop('checked')) $chk.attr('checked', '');
   });   
   return FoxInCloud.DOMEvent($doc.html(), undefined, event)
	ENDTEXT
	Return m.cJS
Endif

Someone can suggest me the code i have to insert to read value from textarea elements and save them in the new html when i save it ? or better.... i can get the value, but i don't know how to save it

If i use this code it saves in the html the textarea with an attribute value with the correct value, but the problem is that textarea has not a "value" attribute like input

      $doc.find('textarea').each(function(idx,txa){
    var $txa = jQuery(txa);
    $txa.attr('value', $txa.value());
   });

Thanks

Gravatar is a globally recognized avatar based on your email address. re: Reading html content
  Michele
  Michele
  Jan 8, 2021 @ 07:36am

SOLVED with

$txa.html($txa.val());

© 1996-2024