Submit from a checkbox that is not in a form

F

FP

I have a list of results. When the user clicks a checkbox I need it to
update the database but I don't want it to reload the current page.
Currently I have the following;
- a checkbox in a form
- the record ID as a hidden value in the form
- using onclick to open a new window
- form targets new window
- new window closes itself

Aside from the window flickering by this works well. The problem is
the form is taking up more space than I want it to so can I due the
same thing but without having to put the checkbox in a form?
 
R

Randy Webb

FP said the following on 7/18/2006 5:05 PM:
I have a list of results. When the user clicks a checkbox I need it to
update the database but I don't want it to reload the current page.

OK, then don't.
Currently I have the following;
- a checkbox in a form
- the record ID as a hidden value in the form
- using onclick to open a new window
- form targets new window
- new window closes itself

Use a hidden IFrame, target the IFrame, nothing "flickers" and you don't
run into popup blockers.
Aside from the window flickering by this works well.

Then I wouldn't consider it "works well".
The problem is the form is taking up more space than I want it
to so can I due the same thing but without having to put the
checkbox in a form?

Nothing in that question makes sense. On the page itself, display wise,
this code:

<form name="myForm" action="something" target="myIFrame">
<input type="checkbox">
<input type="hidden" name="hiddenInput">
</form>

Takes up no more "room" than this does:

<input type="checkbox">
<input type="hidden" name="hiddenInput">

The fact that it is in a form actually makes life easier on you.

Another alternative is to set the src property of an image Object using
the data to be posted as a queryString.
 
F

FP

Randy said:
FP said the following on 7/18/2006 5:05 PM:

OK, then don't.

This is where I was hoping to get some help from the group.


Use a hidden IFrame, target the IFrame, nothing "flickers" and you don't
run into popup blockers.

I never heard of them before, I'm currently looking at an online
tutorial on how to use them.


Nothing in that question makes sense. On the page itself, display wise,
this code:

<form name="myForm" action="something" target="myIFrame">
<input type="checkbox">
<input type="hidden" name="hiddenInput">
</form>

Takes up no more "room" than this does:

<input type="checkbox">
<input type="hidden" name="hiddenInput">

I'm using Safari 1.3.1 on OS X 10.3.9
In the html code I'm displaying a line of text, the checkbox on the
next line, then a comments field. If the checkbox is in a form a 1/2
inch gap appears between the checkbox and comment line. If the
checkbox is not in a form that gap disappears. I assumed this was
consistent behavior between browsers, based on your comment I guess it
isn't. Regardless I would still like for that 1/2 inch gap to
disappear in Safari. The exact code I'm using is:

Gap is there;
<form id="FlagDone" method="post" action="done.php" target="WinDone">
<input type="hidden" name="TheRecID" value="<?PHP RecID ?>">
<P ALIGN=right><FONT SIZE="+1" COLOR="#666666">Done:</FONT>
<INPUT TYPE=checkbox NAME="Done" VALUE="1" onclick="FCDone();">
</P></form>

No gap;
<input type="hidden" name="TheRecID" value="<?PHP RecID ?>">
<P ALIGN=right><FONT SIZE="+1" COLOR="#666666">Done:</FONT>
<INPUT TYPE=checkbox NAME="Done" VALUE="1" onclick="FCDone();">
</P>
 
J

Jeremy

FP said:
I'm using Safari 1.3.1 on OS X 10.3.9
In the html code I'm displaying a line of text, the checkbox on the
next line, then a comments field. If the checkbox is in a form a 1/2
inch gap appears between the checkbox and comment line.

Try this:

<form style="margin: 0; padding: 0;" ...>

Adding that inline CSS will remove any margin or padding that's being
applied to the form, which is what's causing the gap.

You could also do this globally in an external stylesheet, which is a
more graceful method. But that's outside the scope of this group; read
a CSS tutorial to get started.

Jeremy
 
D

Dag Sunde

FP said:
This is where I was hoping to get some help from the group.




I never heard of them before, I'm currently looking at an online
tutorial on how to use them.




I'm using Safari 1.3.1 on OS X 10.3.9
In the html code I'm displaying a line of text, the checkbox on the
next line, then a comments field. If the checkbox is in a form a 1/2
inch gap appears between the checkbox and comment line. If the
checkbox is not in a form that gap disappears. I assumed this was
consistent behavior between browsers, based on your comment I guess it
isn't. Regardless I would still like for that 1/2 inch gap to
disappear in Safari. The exact code I'm using is:

Gap is there;
<form id="FlagDone" method="post" action="done.php" target="WinDone">
<input type="hidden" name="TheRecID" value="<?PHP RecID ?>">
<P ALIGN=right><FONT SIZE="+1" COLOR="#666666">Done:</FONT>
<INPUT TYPE=checkbox NAME="Done" VALUE="1" onclick="FCDone();">
</P></form>

try to add this to your form element:

style="margin-bottom:0px;
 
F

FP

Jeremy said:
Try this:
<form style="margin: 0; padding: 0;" ...>

Thanks, that fixed the problem in Safari.
Just had a look at the site from Netscapte & IE, yikes its ugly!
I got a lot of work to do to try to make this lign up.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,785
Messages
2,569,624
Members
45,318
Latest member
LuisWestma

Latest Threads

Top