473,765 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

wrong variable in text field in firefox

Hello

Try to add some blank text field and refresh window
in IE it is ok but in firefox input hide_show works wrong , why ?
Somebody can help me ?

I'm not good in JS beacause I'm PHP coder

The completly code (mix of PHP and JS):

<?php
// -------------------------------------------------------------------------
----
if ($_POST['save']=="save"){
$account = $_POST['account'];
$hide_show = $_POST['hide_show'];

$_POST =(array_flip (array_values($ _POST)));
$_POST =(array_flip ($_POST));
$y=0;
foreach ($_POST as $key => $val){
if (!empty($val) && $val!="" && strlen($val)==9 ){
$y++;
$arr['n'.($y)]=$val;
$set.= $val.",";
}
}
$arr['n'.($y+1)]=' ';
$_POST=$arr;
$_POST['hide_show']=$y+1;
$_POST['save'] = 'save';
echo ("<pre>");
print_r($_POST) ;
echo ("</pre>");
}
// -------------------------------------------------------------------------
----
if (!isset($_GET['account']) && !isset($_POST['account'])){
$account="numer testowy";
}
else {
if (isset($_POST['account'])){
$account=$_POST['account'];
}
else if (isset($_GET['account'])){
$account=$_GET['account'];
}
}
$form_num=20;
// -------------------------------------------------------------------------
----
?>
<script language="JavaS cript" type="text/javascript">
function show(ida,idb){
id = 'numer' + ida;
if(document.get ElementById(id) ){
var ele = document.getEle mentById(id);
if(ele.style.di splay=="none"){
ele.style.displ ay="block";
document.telacc .hide_show.valu e =
(document.telac c.hide_show.val ue - 0) + idb;
}
}
}
function hide(ida,idb){
if ((document.tela cc.hide_show.va lue - 0) != 1 &&
(document.telac c.hide_show.val ue - 0) != 0 ){
id = 'numer' + ida;
var ele = document.getEle mentById(id);
ele.style.displ ay="none";
document.telacc .hide_show.valu e = document.telacc .hide_show.valu e - idb;
}
}
function form_inp(name_f ield)
{
var Message = "";
var flag = true;
var name;
if (name_field!= "")
{
var wyraz = name_field;
var ilosc = wyraz.length;
wzor=/^[0-9]+$/;
if (ilosc!=9 || wzor.test(wyraz )==false){
name = "Pole musi zawierać 9 cyfr!\n"
flag = false
Message = Message + name
}
}
if (flag == false)
{
alert(Message)
}
}
function telacc_db()
{
var Message = "";
var flag = true;
var name;
if (document.telac c.n1.value != "")
{
var wyraz = document.telacc .n1.value;
var ilosc = wyraz.length;
wzor=/^[0-9]+$/;
if (ilosc!=9 || wzor.test(wyraz )==false){
name = "Pole nr. 1 musi zawierać 9 cyfr!\n"
flag = false
Message = Message + name
}
}
<?php
for ($x=1;$x<$form_ num;$x++){
?>
if (document.telac c.n<?php echo ($x+1); ?>.value != "")
{
var wyraz = document.telacc .n<?php echo ($x+1); ?>.value;
var ilosc = wyraz.length;
wzor=/^[0-9]+$/;
if (ilosc!=9 || wzor.test(wyraz )==false){
name = "Pole nr. <?php echo ($x+1); ?> musi zawierać 9 cyfr!\n"
flag = false
Message = Message + name
}
}
<?php
}
?>
if (flag == true)
{
document.forms['telacc'].submit()
}
else
{
alert(Message)
}
}
</script>
<form action="test_fo rm.php" name="telacc" method="POST">
<input type="hidden" name="save" value="save">
<input type="hidden" name="account" value="<?php echo $account;?>">
<?php
if (!isset($_POST['hide_show']))
{
echo "<input type=\"text\" name=\"hide_sho w\" value=1>";
}
else
{
echo "<input type=\"text\" name=\"hide_sho w\"
value=".$_POST['hide_show'].">";
}
?>
<?php
echo "<div id=\"numer1\" style=\"display :block;\">";
?>
<input type="text" size="9" maxlength="9" name="n1" value="<?php if
($_POST['n1']!=" "){echo $_POST['n1'];} ?>" onclick=show(2, 1);
&nbsp;/&nbsp;<?php echo $account."&nbsp ";?>

<a href=javascript :hide(1,1);
onClick=javascr ipt:document.te lacc.n1.value=' ';><img src="minus.gif"
border=0 align="absmiddl e"></a>
</div>
<?php
for ($x=1;$x<$form_ num;$x++){
echo "<div id=\"numer".($x +1)."\" style=\"display :";
if ($_POST['n'.($x+1)]!=""){
echo "block;\">" ;
}
else {
echo "none;\">";
}
echo "<input size=\"9\" maxlength=\"9\" type=\"text\" name=\"n".($x+1 )."\"
value=\"";
if ($_POST['n'.($x+1)]!=' '){
echo $_POST['n'.($x+1)];
}
echo "\"onClick=show (".($x+2).", 1); onkeyup=show(". ($x+2).",1);
onFocus=form_in p(document.tela cc.n".($x).".va lue);>&nbsp;/&nbsp;".$accoun t."
&nbsp;";
echo "<a href=javascript :hide(".($x+1). ",1);
onClick=javascr ipt:document.te lacc.n".($x+1). ".value='';><im g
src=\"minus.gif \" border=0 align=\"absmidd le\"></a>";
echo "</div>";
}
?>
<br>
<br>
<INPUT name="zapisz" onclick="telacc _db();" type="button" value="Zapisz">
</form>
<?php
// -------------------------------------------------------------------------
----
if ($_POST['save']=="save"){
if ($set==""){
echo "Kwerenda jest pusta!";
exit;
}
else {
echo $set."<br>".$ac count;
}
}
echo ("<pre>");
print_r($_POST) ;
echo ("</pre>");
// -------------------------------------------------------------------------
----
?>

Mar 22 '06 #1
3 2133
JaRudzik said the following on 3/22/2006 3:54 AM:
Hello

Try to add some blank text field and refresh window
in IE it is ok but in firefox input hide_show works wrong , why ?
Somebody can help me ?

I'm not good in JS beacause I'm PHP coder

The completly code (mix of PHP and JS):


When posting code, only post what gets sent to the browser. Or, post a
URL to a sample page. That way, people who may help you only have to
copy/paste the code or click a link to see it. Makes life a lot simpler.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Mar 22 '06 #2
http://www.studio-er.home.pl/test_form.php

for testing

BR.
Rafal
Mar 22 '06 #3
OK I resolved that
my own :)

<body onload=javascri pt:document.tel acc.hide_show.v alue='<?php echo
$_POST['hide_show']; ?>';>

BR
Rafał

Użytkownik "JaRudzik" <ja*********@po czta.onet.pl> napisał w wiadomo¶ci
news:dv******** **@news.onet.pl ...
http://www.studio-er.home.pl/test_form.php

for testing

BR.
Rafal

Mar 23 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2178
by: Jack | last post by:
Hi, I got a asp form page where the POST ACTION = confirmation.asp page is used to save the values collected from text boxes from the form in a database. For example txtTotalOutlay field is being used in confirmation.asp page to update a database field. However, there is a field in the form which is calculated field e.g. NetOutlay = .90 * txtTotalOutlay. This NetOutlay is thus not a text field. However, in the confirmation field I...
3
3277
by: snowweb | last post by:
I'm creating my first web application in PHP/MySQL, however, when I go to view the database contents, the data has been stored in the wrong columns. I've gone through my insertion code with a fine toothcomb and can see no errors which might cause this. I will post the code below, and you will see that I have some diagnostics built in, which show that the information (at least at that point) appears to be about to be stored in the correct...
4
1921
by: _Raven | last post by:
Okay, I am playing with submitting forms with Ajax. I am trying to adapt this script to my forms: http://www.captain.at/howto-ajax-form-post-get.php I have included my code at the bottom of this post. Basically, this will work correctly if I remove all non-form related tags from the form =eg span, div, but I want to format the form all pretty like so??? Right now, it only collects 2 parts of the form fields =sites &
4
4382
by: somewildmonkey | last post by:
I'm running Firefox version 1.5.0.6 and when I load an html file containing the code shown below, although both the text field and the button are defined as 24 pixels in height, the text field is displayed 30 pixels tall. In Internet Explorer they display as specified. Any ideas why Firefox is adding 6 pixels to the height of the text field? - MB
2
10917
by: neeebs | last post by:
Hi, I'm not sure if this is a javascript problem per se, but here goes. I have an xsl document with a python function defined within a <script> block. Elsewhere in the xsl file, within a python script block, I call the python function and store the return value in a variable. I need to be able to display this returned value on the webpage that the xsl generates. I tried to do a document.write() but found that document.write() causes...
3
4619
by: Klaus Brune | last post by:
Hello all, When one tabs through a form (specifically, in Firefox), all the text in a field is automatically selected. What I'm looking for is a way to put a function (in onFocus perhaps) that will automatically move to the END of the existing text (a blinking cursor). Yes, I've Googled, but cannot seem to locate just what I'm looking for.
3
4322
by: dugald.morrow | last post by:
I have some javascript that updates the text in a text field after certain actions take place such as clicking a checkbox. The javascript works fine in Safari and Firefox, but in IE, the text in the text field remains empty. The page containing this problem is at the following location: http://www.skicow.com/component/option,com_skicow/act,shop/Itemid,51/debug_enabled,true The last parameter enables debug which results in alerts...
6
1471
by: Tony Johansson | last post by:
Hello! I'm reading in a book called Visual C# 2005. In the chapter about Generics there ia a section about Nullable types. Here is the text that isn't complete true I think. It says: "You can also look at the value of a reference type using the Value property. If HasValue is true, then you are guarantee a non-null value for Value, but if HasValue is false, that is, null has been assigned to the variable, then accessing Value will
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9399
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10163
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9957
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9835
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7379
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.