Forums

Raw string output

awgcas 25 Nov, 2014
Hi,
I need Chronoforms to output a single "raw" string, something like "OK"

Adding "&tmpl=component" I disabled all the template part, and this is what I get:

<script type="text/javascript">
		if("undefined"==typeof window.jQuery){}else{
			var gcore_jQuery_bak = window.jQuery;
			var gcore_$_bak = window.$;
		}
		if("undefined"==typeof gcore_jQuery){}else{
			window.jQuery = gcore_jQuery;
			window.$ = gcore_$;
		}
		</script>
		
<script src="http://192.168.1.100/securtag/libraries/cegcore/assets/jquery/jquery.js" type="text/javascript"></script>
<script src="http://192.168.1.100/securtag/libraries/cegcore/assets/bootstrap/js/bootstrap.js" type="text/javascript"></script>

		<script type="text/javascript">
		if("undefined"==typeof gcore_jQuery){
			var gcore_jQuery = window.jQuery;
			var gcore_$ = window.$;
		}
		if("undefined"==typeof gcore_jQuery_bak){}else{
			window.jQuery = gcore_jQuery_bak;
			window.$ = gcore_$_bak;
		}
		</script>
		<div class="gbs3">OK</div>

I need just only a string because I have to pass it back to an android app, and the app "does not like" the javascript sections (and the div, at the last line of code...)
How I can clean up the output?
Thanks in advance.
Alessandro
GreyHead 26 Nov, 2014
Hi Alessandro,

How are you calling this? You should be able to do it with a separate form event with just a custom code action in it. Add a Custom Code action set to Pure code followed by a Show Stopper. Then call it with &format=raw

e.g. index.php?option=com_chronoforms5&chronoform=form_name&event=event_name&format=raw

Bob
awgcas 26 Nov, 2014
Hi Bob,
I am already doing what you suggest, in onload event; I do some queries, check some values, and depending on these values I have to produce two different output strings, let's say "OK" and "NO OK".

Adding &format=raw to the url of my current version of the form does not work, I always get the javascript sections in the output.

This evening I will try adding another event to my form and calling with the url you suggest.
I am not able to find "Pure code" setting for Custom Code action; where can I find it?

Thank you very much for your support
Alessandro
GreyHead 26 Nov, 2014
Hi Alessandro,

I'm not too clear how you expect this to work. Do you get clean output if you leave out the HTML (Render Form) action? That's the one that adds the script.

The Pure code option is only in the element, not the action, sorry - faulty memory,

Bob



Bob
awgcas 26 Nov, 2014
I am sorry, I will try to explain in more detail what I am trying to do.
I have an android app (unfortunately I am not the author ...) that sends some post variables to an url.
At that url there is a chronoform (see attached image below) only with a custom code, that takes the post variables, reads a row from a mysql table, does some checks, and returns a string.
This string is what the app waits for; depending on the string returned, the app sends additional data or not. The problem is that the app looks for that string only, no other text. Instead I get the string with javascript loaded.
If you need I can post the code, but I think it's not important.



As you can see I did not include the Render Form action, but the scripts are still there ...
I added the Show Stopper, as per your suggestion, but with no luck ...

Thanks again
I apologize if my english is not so good ...
Alessandro
awgcas 27 Nov, 2014
Answer
Hi Bob,
I solved my problem installing CF4, copying the code in the custom code action and setting "Add form tags" to No.

Now the output is only "OK<div class="chronoform"><a href="http://www.chronoengine.com">Powered By ChronoForms - ChronoEngine.com</a></div>", the copyright info.

I have only to buy CF license to disable the copyright info.

Thanks again for your support.
Regards,
Alessandro
GreyHead 30 Nov, 2014
Hi Alessandro,

If you don't have the HTML (Render Form) action you should be able to generate clean output. That's how ChronoForms works when we set up a new Event to send data to an Ajax request from a form.

Bob
awgcas 01 Dec, 2014
Hi Bob,
I setup a simple form with just a custom code in on load event including an echo instruction.

You can see it at:

http://www.securtag.it/index.php?option=com_chronoforms5&chronoform=pippo&format=raw

If you check the page source code you will find the output I included in my first post, with javascript call and the final div.
I bought the license a few days ago to disable the copyright info.

At http://www.securtag.it/index.php?option=com_chronoforms&chronoform=upload_dati_4&format=raw the CFV4 version of the real form: the page source code is empty, as it should be with format=raw.

I suppose that CFv5 is a little different, so the output is not completely empty ....

Thank you
Regards
Alessandro
GreyHead 02 Dec, 2014
Hi Alessandro,

Have you tried it with a new event?

Bob
awgcas 02 Dec, 2014
Hi Bob, yes I tried but no success ...

Maybe the CFv5 equivalent setting for "Add form tags"?
Or some other feature not yet implemented in CFv5 ....

Alessandro
This topic is locked and no more replies can be posted.