Connecting Tech Pros Worldwide Help | Site Map

Submit from a checkbox that is not in a form

FP
Guest
 
Posts: n/a
#1: Jul 18 '06
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?

Randy Webb
Guest
 
Posts: n/a
#2: Jul 18 '06

re: Submit from a checkbox that is not in a form


FP said the following on 7/18/2006 5:05 PM:
Quote:
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.
Quote:
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.
Quote:
Aside from the window flickering by this works well.
Then I wouldn't consider it "works well".
Quote:
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.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Temporarily at: http://members.aol.com/_ht_a/hikksnotathome/cljfaq/
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
FP
Guest
 
Posts: n/a
#3: Jul 19 '06

re: Submit from a checkbox that is not in a form


Randy Webb wrote:
Quote:
FP said the following on 7/18/2006 5:05 PM:
Quote:
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.
This is where I was hoping to get some help from the group.


Quote:
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.


Quote:
Quote:
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">
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>

Jeremy
Guest
 
Posts: n/a
#4: Jul 19 '06

re: Submit from a checkbox that is not in a form


FP wrote:
Quote:
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
Dag Sunde
Guest
 
Posts: n/a
#5: Jul 19 '06

re: Submit from a checkbox that is not in a form


FP wrote:
Quote:
Randy Webb wrote:
Quote:
>FP said the following on 7/18/2006 5:05 PM:
Quote:
>>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.
>
This is where I was hoping to get some help from the group.
>
>
>
Quote:
>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.
>
>
>
Quote:
Quote:
>>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">
>
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;

--
Dag.

style="margin-bottom:0px;


FP
Guest
 
Posts: n/a
#6: Jul 19 '06

re: Submit from a checkbox that is not in a form


Jeremy wrote:
Quote:
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.

Closed Thread