Saturday, 15 May 2010

javascript - Why is my form is not posting with jQuery .submit()? -



javascript - Why is my form is not posting with jQuery .submit()? -

i working on scheme users allowed add together books library. using jquery ui dialog box , have inserted 20 rows database using first half of script.

however, adding in sec half of sudden post info not showing on posted page , lost why.

this supposed quick add-on that's turned headache.

form:

<form id="addbookform" action="../models/books/addbook_submit.cfm" method="post"> <div style="display: none;" id="addbook" title="add book library"> <input type="hidden" id="inputtype" name="inputtype" value="add"/> <input type="hidden" id="bookempid" name="bookempid"/> <label class="labelstyle" >isbn:</label> <input type="text" maxlength="17" id="isbn" name="isbn"> <label class="labelstyle" >title:</label> <input type="text" maxlength="100" size="50" id="title" name="title">* <label class="labelstyle">author's first name: </label> <input type="text" maxlength="50" id="afname" name="afname"> <label class="labelstyle">author's middle name:</label> <input type="text" maxlength="50" id="amname" name="amname"> <label class="labelstyle">author's lastly name:</label> <input type="text" maxlength="50" id="alname" name="alname">* <label class="labelstyle">date read:</label> <input type="text" id="dateread" name="dateread"> </div> </form>

javascript:

function addbook() { $("#addbook").dialog({ autoopen: true, width: ($(document).width()*.55), height: ($(document).height()*.7), modal: true, buttons: { "add book": function() { //checkbook(); $('#addbookform').submit(); }, cancel: function() { $(this).dialog("close"); } } }); }

the above piece working before started building checkbook(). however, it's no longer working.

edit:

the form initiated by: <input type="button" class="buttonstyle" value="add book" onclick="addbook()" /> (this works)

i think form must "visible" in order elements posted. jquery can see , access of elements regardless of css display type, believe "submit" action requires elements getting posted server visible. noticed form elements attempting submit within of div element css property of display:none;

javascript jquery jquery-ui

No comments:

Post a Comment