ahalmen Posted September 27, 2006 Share Posted September 27, 2006 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 /> HTML Template <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"; }} Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted September 27, 2006 Share Posted September 27, 2006 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. Quote Link to comment Share on other sites More sharing options...
ahalmen Posted September 27, 2006 Author Share Posted September 27, 2006 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 Quote Link to comment Share on other sites More sharing options...
fenway Posted September 27, 2006 Share Posted September 27, 2006 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. Quote Link to comment Share on other sites More sharing options...
ahalmen Posted September 28, 2006 Author Share Posted September 28, 2006 Solved the problem, I just embeded the second form in the first one. Thanks for the help!Andreea Quote Link to comment Share on other sites More sharing options...
fenway Posted September 28, 2006 Share Posted September 28, 2006 If that works, it shouldn't... nested forms aren't really valid. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.