RE: Javascript + php problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sure Thing Joe!

 

I use AJAX framework ?prototype? so instead make readonly= false, I make
here the texfield without the readonly, check:

 

<?php 

$my_user = $_GET['user'];

$my_pass = $_GET['pass'];

$validado = false;

$monto = obtiene_campo("tbl_citas", "pk_aut_cita", $_GET['cita'],
"int_monto");

$matriz = conn_busqueda("SELECT txt_user,txt_pass,int_permisos FROM
tbl_profesionales");

while($row = mysql_fetch_array($matriz))

{              

                $this_user = $row['txt_user'];

                $this_pass = $row['txt_pass'];

                if ( ($this_user == $my_user)&&($this_pass == $my_pass) &&
($row['int_permisos']==1) ){ ?>

                                <input type="text" size="10"
name="int_monto" id="int_monto"   value="<?php echo $monto ?>" />

                                <img src="images/tick.png" title="Permiso
consedido" alt="Permiso consedido">

<?php   $validado = true;

                }              

}

if (!$validado){?>

    <input type="text" size="10" name="int_monto" id="int_monto" readonly
value="<?php echo $monto ?>" />

    <img src="images/denied.png" title ="No encontramos el usuario, o no
tiene permisos para esta Operacion" alt="No encontramos el usuario, o no
tiene permisos para esta Operacion">

<?php } ?>

 

And I call this like this in the main page:

 

function validate(cita)

{

                var user = document.send.usuario.value;

                var pass = document.send.password.value;

                new
Ajax.Updater('validate','get_cobrar_validate.php?user='+user+'&pass='+pass+'
&cita='+cita, {method:'get'});

                return false;

}

 

Where validate id is:

 

<span id="validate"><input type="text" size="10" name="int_monto"
id="int_monto" readonly  value="<?php echo $monto ?>" /></span>

 

Yes.. it?s a little complicated but look very nice in the browser :P

 

---------------------------

 

Hi Jean,

Would you mind sending us the code so we can see what the solution 
was that you came up with?
--
Joe

On Sep 25, 2008, at 4:54 PM, Jean Carlo wrote:

> Never mind! I found another way to do it, thanks for your help anyway!
>
> _________________________________
>
> > I want to after I make an if(.) if it's true call a javascript
> > function, but it doesn't work, here is the code
> >
>
> Just a obvius note, but as you don't sent all code, we can only guess.
>
> Remember that you can not call a javascript function from PHP. You can
> only put Javascript code that is executed when the page (PHP 
> result) is
> loaded.
>
> Normally, I put this kind of code, in a funcion called in the "onLoad"
> event of the page; to assure the page is loaded, and the form is 
> correctly
> displayed.
>
> I suposse your code may be actually working, but just before the 
> form be
> active.
>
> And as my personal prefered choice, you can replace your javascript 
> code,
> for a simple line on your form:
>
> <input type='text' name='int_amount' <?php
> if ( ($this_user != $my_user)||($this_pass != $my_pass) )
> echo " READONLY";
> ?>>
>
> -- 
> José Miguel Santibáñez
> jms@xxxxxxxxx <mailto:jms%40nivel5.cl>  <mailto:jms%40nivel5.cl>
>
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com
> Version: 8.0.169 / Virus Database: 270.7.2/1690 - Release Date: 
> 9/25/2008
> 7:05 AM
>
> [Non-text portions of this message have been removed]
>
>
> 

[Non-text portions of this message have been removed]

 

No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.169 / Virus Database: 270.7.2/1690 - Release Date: 9/25/2008
7:05 AM



[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux