Connecting Tech Pros Worldwide Help | Site Map

Submit from a checkbox that is not in a form

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 18th, 2006, 09:05 PM
FP
Guest
 
Posts: n/a
Default Submit from a checkbox that is not in a form

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?


  #2  
Old July 18th, 2006, 10:05 PM
Randy Webb
Guest
 
Posts: n/a
Default 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/
  #3  
Old July 18th, 2006, 11:45 PM
FP
Guest
 
Posts: n/a
Default 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>

  #4  
Old July 19th, 2006, 12:15 AM
Jeremy
Guest
 
Posts: n/a
Default 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
  #5  
Old July 19th, 2006, 12:25 AM
Dag Sunde
Guest
 
Posts: n/a
Default 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;


  #6  
Old July 19th, 2006, 12:55 AM
FP
Guest
 
Posts: n/a
Default 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.

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.