RE: [SMARTY] question
| From: | Josh Johnson | Date: | Thu, 19 Sep 2002 11:54:41 +0000 |
| Subject: | RE: [SMARTY] question | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-5998@lists.php.net to get a copy of this message | ||
I'm guessing you mean the value of a field in your form, so I'm also
assuming that the form is submitted, and then the db is queried and the
condition checked, so that the popup would... "pop up" at that point.
I'm also guessing that you're inserting a <script> tag at some point
within the page.
First thing I would check is if the javascript appears in the source
code of the web page or not. If it doesn't, there's your problem. If it
does, then maybe you should set it up a bit differently than the way I'm
assuming you've got it set up:
The code would look like this:
<? ...
database code in some other file that is included
after you instantiate your smarty object, But before
you call $smarty->display();
assign template var
$matched, set to 0 if it doesn't
1 if it does.. you could do this with a
smarty plugin or something too, see the docs.
... ?>
<html>
<head>
</head>
{if $matched == 1}
{literal}
<script>
...
javascript function to pop up
correct window here
...
{/literal}
</script>
{/if}
<body {if $matched == 1}onLoad="that function you defined above"{/if}>
...
</body>
</html>
That way the function to pop up the window is called when the page
loads, and should produce the effect I think you want :)
-- Josh
-----Original Message-----
From: Primak Irina [mailto:sirenap@techst02.technion.ac.il]
Sent: Tuesday, September 17, 2002 5:35 AM
To: smarty-general@lists.php.net
Subject: [SMARTY] question
Hi, all!
I am trying to create pop up box that will appear if the field of the
form
is identical to some field in my database. It seems that when I wrap
JavaScript (that creates pop up message box> in php condition, the
script
ignores it.
I will appreciate, if somebody helps me.
--
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php