[Klone-users] Onclick-Events

Steven Dorigotti dorigotti at koanlogic.com
Mon Mar 10 12:21:50 EDT 2008


On 10/mar/08, at 16:56, diakat 2000 wrote:

> Hi Steven,
>
> yes, I know about that.
> So, it seems, that there is no possibility to mix C/C++ and  
> javascript.

It's impossible to mix C and javascript because javascript is client- 
side (browser) and the C code in klone files (.kl1) is server-side.

KLone gives the ability to run both client and server on the same  
machine, but this usually isn't the case over the web...

> Maybe, is it possible to set a  variable with javascript and read it
> out with C/C++?
>
> Explanation:
> I will have serval buttons on a form. For example to edit a table: one
> button for saving, one button for inserting a new row, one button for
> deleting an existing row... So, there's why I have to know, which
> button was clicked.

Since we are talking about the HTTP protocol, the only way to  
interface with C code is via forms (http://www.w3.org/TR/html4/interact/forms.html 
). Usually you would use the "name" parameter to identify elements.  
You can simply parse such parameter in C code...

> Many thanks

cheers,
sd


> 2008/3/10, Steven Dorigotti <dorigotti at koanlogic.com>:
>>
>> Hi,
>>
>>  If you have a look at the definition of the onclick parameter
>> (http://www.w3schools.com/jsref/jsref_onclick.asp), you'll
>> see that it's javascript-specific.
>>
>>  If you want to post parameters to C code you should be posting  
>> variables
>> to a page and retrieving them from the taget page using  
>> request_get_arg()...
>>
>>  Check out the tutorial for an example:
>> http://koanlogic.com/klone/tut.html
>>
>> good luck!
>> sd
>>
>>
>>
>> On 10/mar/08, at 14:43, diakat 2000 wrote:
>>
>> Hello,
>>
>> I've just another newbie question: How could I do event handling with
>> C/C++ functions?
>>
>> I've a form with serveral input field. I' m able to access on a  
>> sqlite
>> database and display some values in the fields. Now I want to save
>> user changes back in database. But something goes wrong. My code  
>> looks
>> like:
>>
>>
>> // C method
>> int dbSaveDescriptionAll ()
>> {
>> ... saving all Fields in database (sqlite)
>> return 1;
>> }
>>
>> // my form
>>  <form action ="testpage.kl1" method ="post" enctype="multipart/ 
>> form-data">
>> .... // some input-fields
>>
>> // my form button
>>  <% io_printf (out, <input type= \"button\" name = \"bt_save"
>> value=\"save\" onclick= \"dbSaveDescriptionAll()\"/>");
>> %>
>>
>> It seems that the function dbSaveDescriptionAll() is uncalled.
>>
>> I hope somebody could tell me what I'm doing wrong.
>>
>> Ciao
>>
>> _______________________________________________
>> Klone-users mailing list
>> Klone-users at koanlogic.com
>> http://koanlogic.com/cgi-bin/mailman/listinfo/klone-users
>>
>>
>>
>> _______________________________________________
>> Klone-users mailing list
>> Klone-users at koanlogic.com
>> http://koanlogic.com/cgi-bin/mailman/listinfo/klone-users
>>
>>
>
> _______________________________________________
> Klone-users mailing list
> Klone-users at koanlogic.com
> http://koanlogic.com/cgi-bin/mailman/listinfo/klone-users
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://koanlogic.com/pipermail/klone-users/attachments/20080310/16122439/attachment.htm


More information about the klone-users mailing list