Jump to content

question about onclick


richarro1234

Recommended Posts

Hello,

 

i would like to know if its possible to have a form that will allow someone to update a text field with an onlcik (of offclick)

so for instance,

if i was to update my mood, it would show my current mood (which is set in the database) then, when i click on it, it will change to a text field so i can type my new mood in there, then when i click outside the box, it will save my mood as what i just typed. or maybe just have a "post" button next to the text, but it doesnt load a new page so it just updates the database without the page bein reloaded.

 

Thanks

Rich

Link to comment
Share on other sites

Hello..

 

This can be done with ajax.. and javascript.. and php

 

use javascript to display the text box on the "OnClick" event, and then enter the data.

 

ajax can be used to send this new data to ur database for updation. [u will need a php file to handle the data from ajax and update table at the other end].

 

now u can use javascript to specify, if the form [ie the text field, ]needs to be submitted when u click outside the text box, or with an update button.

 

Learn more abt ajax, and javascript  :)  . u will get more ideas then

 

Rakesh

Link to comment
Share on other sites

You can use a lot of techniques for this; Javascript,an HTML Form pointing to a PHP script, and AJAX.

 

For the characteristics you mentioned(having your mood in a database) Javascript is discarded(only client side programming), then you have two options left: HTML form or AJAX.

 

My opinion will be to use AJAX, because this prevents having to refresh your browser, on the other hand it is more complex to set. You can try HTML first and then move on.

 

Angel

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.