Jump to content

Archived

This topic is now archived and is closed to further replies.

ahalmen

html help

Recommended Posts

I have a checkbox in html that when checked enables an editor. I want to save the text written in this editor to the db, but il only adds null. Can't figure why. Here's the code

<form name="html_t"><br />&nbsp;HTML Template
&nbsp;<input type="checkbox" name="html" id="html" onchange="show_hide(html);" />
</form>
<div id="div_editor" style="display:none;">
<form name="editor">
    <textarea name="html_content" id="html_content" cols="50" rows="10"></textarea>
        </form>
</div>

and here is the js

function show_hide(chck){
  if(chck.checked==1){
    document.getElementById('div_editor').style.display = "";
  }
  else{
    document.getElementById('div_editor').style.display = "none";
  }
}

Share this post


Link to post
Share on other sites
You need a submit action for the form pointing to an appropriate script to perform the transaction.

You also do not need two forms in there - just have the one.

Share this post


Link to post
Share on other sites
I already have a submit form, because besides that textarea I have another one that is not triggered by a checkbox, and I can see that value and add it to the database. I don't know what the problem is.


Thanks,
Andreea

Share this post


Link to post
Share on other sites
The problem with two forms is that only one submits -- apparently, not the one with the textarea -- so you'll never be able to get that value unless you play with hidden fields.

Share this post


Link to post
Share on other sites
Solved the problem, I just embeded the second form in the first one. Thanks for the help!

Andreea

Share this post


Link to post
Share on other sites
If that works, it shouldn't... nested forms aren't really valid.

Share this post


Link to post
Share on other sites

×

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.