date format L8 and MySQL

classic Classic list List threaded Threaded
22 messages Options
12
Reply | Threaded
Open this post in threaded view
|

date format L8 and MySQL

Mike Ealy-2
I'm converting an old Lasso 3.6/Filemaker solution over to Lasso 8/MySQL and
I'm having some date trouble. This solution is only used by one person in
our office. She tends to be on the stubborn side and resists change whenever
possible. She may enter a date as 9/5/06 one time, another time as
09/05/2006, and another as 9/05/06. She hates the idea of entering a date as
yyyy-mm-dd. I need to get whatever date format she enters into MySQL as
2006-09-05. I don't want to go the pull-down month/day/year route. She would
hate that. I'm trying to please my 'customer' here.

Any ideas? I've looked in the archives for a solution to this problem, but
I'm not having any luck.

Mike Ealy


============================================
Attend the Lasso Summit
March 2-7, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: date format L8 and MySQL

Doug Gentry
I wonder if Bil Corry's string to date tag on tagswap.net would help.

http://tagswap.net/lp_date_stringToDate

It may allow your recalcitrant office person to enter in a single  
string field and then you could post-process it before inserting it  
into the database.

....Doug

On Nov 14, 2006, at 9:30 AM, Mike Ealy wrote:

> I'm converting an old Lasso 3.6/Filemaker solution over to Lasso 8/
> MySQL and
> I'm having some date trouble. This solution is only used by one  
> person in
> our office. She tends to be on the stubborn side and resists change  
> whenever
> possible. She may enter a date as 9/5/06 one time, another time as
> 09/05/2006, and another as 9/05/06. She hates the idea of entering  
> a date as
> yyyy-mm-dd. I need to get whatever date format she enters into  
> MySQL as
> 2006-09-05. I don't want to go the pull-down month/day/year route.  
> She would
> hate that. I'm trying to please my 'customer' here.
>
> Any ideas? I've looked in the archives for a solution to this  
> problem, but
> I'm not having any luck.
>
> Mike Ealy
>
>
> ============================================
> Attend the Lasso Summit
> March 2-7, 2007 in Fort Lauderdale, FL
> http://www.LassoSummit.com/
> ============================================
>
> ------------------------------
> Lasso Support: http://support.omnipilot.com/
> Search the list archives: http://www.listsearch.com/lassotalk.lasso
> Manage your list subscription:
> http://www.listsearch.com/lassotalk.lasso?manage



---
Doug Gentry
Dynapolis & Southern Oregon University
p:  541-261-8501 / Toll Free: 888-490-0644
[hidden email]
www.dynapolis.com



============================================
Attend the Lasso Summit
March 2-7, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: date format L8 and MySQL

Adam Randall-4
In reply to this post by Mike Ealy-2
If you take the value coming in and pass it through the date tag, all  
the versions she enters should come out the same. You can then take  
the date object and convert it into a YYYY-MM-DD format date simply  
by using the ->format date member tag.

Here is an example:

[(date: (action_param: 'date'))->(format: '%Q')]<br>
[(date: '9/5/06')->(format: '%Q')]<br>
[(date: '09/05/2006')->(format: '%Q')]

You can then take that newly formatted date and place it in your SQL  
table.

Adam.

--
Adam Randall <[hidden email]>
Senior Web Architect
Stork Avenue, Inc.
http://www.storkavenue.com/
(800) 861-5437
AIM/iChat: blitz574

"It's hard to be religious when certain people are never incinerated  
by bolts of lightning." -- Calvin

On Nov 14, 2006, at 9:30 AM, Mike Ealy wrote:

> I'm converting an old Lasso 3.6/Filemaker solution over to Lasso 8/
> MySQL and
> I'm having some date trouble. This solution is only used by one  
> person in
> our office. She tends to be on the stubborn side and resists change  
> whenever
> possible. She may enter a date as 9/5/06 one time, another time as
> 09/05/2006, and another as 9/05/06. She hates the idea of entering  
> a date as
> yyyy-mm-dd. I need to get whatever date format she enters into  
> MySQL as
> 2006-09-05. I don't want to go the pull-down month/day/year route.  
> She would
> hate that. I'm trying to please my 'customer' here.
>
> Any ideas? I've looked in the archives for a solution to this  
> problem, but
> I'm not having any luck.
>
> Mike Ealy
>
>
> ============================================
> Attend the Lasso Summit
> March 2-7, 2007 in Fort Lauderdale, FL
> http://www.LassoSummit.com/
> ============================================
>
> ------------------------------
> Lasso Support: http://support.omnipilot.com/
> Search the list archives: http://www.listsearch.com/lassotalk.lasso
> Manage your list subscription:
> http://www.listsearch.com/lassotalk.lasso?manage


============================================
Attend the Lasso Summit
March 2-7, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: date format L8 and MySQL

Brian Loomis
In reply to this post by Doug Gentry
you can also format the field in filemaker on a layout as 0000-00-00  
but when users click into it they type as they want.

when you export from FileMaker you can specify use layout formatting  
options to get the date as it appears on the layout.


On Nov 14, 2006, at 10:39 AM, Doug Gentry wrote:

> I wonder if Bil Corry's string to date tag on tagswap.net would help.
>
> http://tagswap.net/lp_date_stringToDate
>
> It may allow your recalcitrant office person to enter in a single  
> string field and then you could post-process it before inserting it  
> into the database.
>
> ....Doug
>
> On Nov 14, 2006, at 9:30 AM, Mike Ealy wrote:
>
>> I'm converting an old Lasso 3.6/Filemaker solution over to Lasso 8/
>> MySQL and
>> I'm having some date trouble. This solution is only used by one  
>> person in
>> our office. She tends to be on the stubborn side and resists  
>> change whenever
>> possible. She may enter a date as 9/5/06 one time, another time as
>> 09/05/2006, and another as 9/05/06. She hates the idea of entering  
>> a date as
>> yyyy-mm-dd. I need to get whatever date format she enters into  
>> MySQL as
>> 2006-09-05. I don't want to go the pull-down month/day/year route.  
>> She would
>> hate that. I'm trying to please my 'customer' here.
>>
>> Any ideas? I've looked in the archives for a solution to this  
>> problem, but
>> I'm not having any luck.
>>
>> Mike Ealy
>>
>>
>> ============================================
>> Attend the Lasso Summit
>> March 2-7, 2007 in Fort Lauderdale, FL
>> http://www.LassoSummit.com/
>> ============================================
>>
>> ------------------------------
>> Lasso Support: http://support.omnipilot.com/
>> Search the list archives: http://www.listsearch.com/lassotalk.lasso
>> Manage your list subscription:
>> http://www.listsearch.com/lassotalk.lasso?manage
>
>
>
> ---
> Doug Gentry
> Dynapolis & Southern Oregon University
> p:  541-261-8501 / Toll Free: 888-490-0644
> [hidden email]
> www.dynapolis.com
>
>
>
> ============================================
> Attend the Lasso Summit
> March 2-7, 2007 in Fort Lauderdale, FL
> http://www.LassoSummit.com/
> ============================================
>
> ------------------------------
> Lasso Support: http://support.omnipilot.com/
> Search the list archives: http://www.listsearch.com/lassotalk.lasso
> Manage your list subscription: http://www.listsearch.com/ 
> lassotalk.lasso?manage


============================================
Attend the Lasso Summit
March 2-7, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: date format L8 and MySQL

Bil Corry-3
In reply to this post by Mike Ealy-2
Mike Ealy wrote:

> I'm converting an old Lasso 3.6/Filemaker solution over to Lasso 8/MySQL and
> I'm having some date trouble. This solution is only used by one person in
> our office. She tends to be on the stubborn side and resists change whenever
> possible. She may enter a date as 9/5/06 one time, another time as
> 09/05/2006, and another as 9/05/06. She hates the idea of entering a date as
> yyyy-mm-dd. I need to get whatever date format she enters into MySQL as
> 2006-09-05. I don't want to go the pull-down month/day/year route. She would
> hate that. I'm trying to please my 'customer' here.
>
> Any ideas? I've looked in the archives for a solution to this problem, but
> I'm not having any luck.

As long as she enters the date using slashes in the order of month/day/year, you can just cast the string to the [date] type, then format it for MySQL:

        var:'datestring' = '9/05/06';
        var:'date' = (date: $datestring);
        var:'mysql_date' = $date->(format:'%Q');

        $mysql_date; // returns 2006-09-05


If she enters the date a bit more oddly, say "Sept 5, 2006" then you should look at lp_date_stringtodate as Doug pointed out:

        <http://tagswap.net/lp_date_stringToDate>

Now, that ctag relies on other ctags, that rely on other ctags and it'll take you all day to download them individually.  Instead, just download the whole lot of them here:

        <http://tagswap.net/lp__library>


- Bil


============================================
Attend the Lasso Summit
March 2-7, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: date format L8 and MySQL

Fletcher Sandbeck
In reply to this post by Mike Ealy-2
On 11/14/06 at 12:30 PM by [hidden email] (Mike Ealy):

>I'm converting an old Lasso 3.6/Filemaker solution over to Lasso 8/MySQL and
>I'm having some date trouble. This solution is only used by one person in
>our office. She tends to be on the stubborn side and resists change whenever
>possible. She may enter a date as 9/5/06 one time, another time as
>09/05/2006, and another as 9/05/06. She hates the idea of entering a date as
>yyyy-mm-dd. I need to get whatever date format she enters into MySQL as
>2006-09-05. I don't want to go the pull-down month/day/year route. She would
>hate that. I'm trying to please my 'customer' here.
>
>Any ideas? I've looked in the archives for a solution to this problem, but
>I'm not having any luck.

The [Date] tags should handle all the formats you've shown properly.  They are forgiving of 2-digit versus 4-digit years and of leading 0s.  It should be enouhg for you to pass the [Action_Param] through [Date_Format] before you put it in the database.

[Inline: ...,
                'datefield' = (Date_Format: (Action_Param: 'date'), -Format='%Q'),
                ...]
        ...
[/Inline]

You can try different variations, but these all work fine.

[Date_Format: '09/05/2006', -Format='%Q']
[Date_Format: '9/5/6', -Format='%Q']
[Date_Format: '9/05/2006', -Format='%Q']
[Date_Format: '09/5/06', -Format='%Q']

Hope this helps,

[fletcher]
--
Fletcher Sandbeck                         [hidden email]
Director of Product Development       http://www.lassostudio.com
OmniPilot Software, Inc.                http://www.omnipilot.com

============================================
Attend the Lasso Summit
March 2-7, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: date format L8 and MySQL

Mike Ealy-2
> The [Date] tags should handle all the formats you've shown properly.

Cool! Thanks to all who replied.

Mike


============================================
Attend the Lasso Summit
March 2-7, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

FileMaker script from LP7 still not working

Jeremy Reynolds-2
In reply to this post by Bil Corry-3
I've looked through many of the logs and can't get it to work.

Having a problem posting to the Lasso List as well.  Getting lots of
bounce-backs.

Jeremy

============================================
Attend the Lasso Summit
March 2-7, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: FileMaker script from LP7 still not working

Jeremy Reynolds-2
I get this error:

Error while performing FileMaker database -findall action.

[Inline: -FindAll,
          -Username='U',
          -Password='P',
          -Database='O',
          -Table='Web',
          -FMScript='Fix Data In O Daily']
[/Inline]

[Error_CurrentError]
----------------------------------------

============================================
Attend the Lasso Summit
March 2-7, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Modifying forms with a POP-UP. Javascript? AJAX?

Israel Thompson
Hello everyone,

I'm trying to dynamically refresh form elements on a page after making
changes using a pop-up. i.e. A list/menu that's populated within the form
needs a new option, so the pop-up is opened then the new object is added to
the database and the pop-up is closed. The form automatically refreshes the
list/menu to reflect the new object, but the entire page is not reloaded and
any previously selected or filled in text boxes are not changed.

Can someone point me in the right direction?

Much thanks,

Israel Thompson


============================================
Attend the Lasso Summit
March 2-7, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Modifying forms with a POP-UP. Javascript? AJAX?

Nikolaj de Fine Licht
Israel,

Can you post some code, just some representative sample code of what  
you want to do? Its hard to imagine why you don't get your page  
reload and/or updated data without seeing what you do. It sounds like  
a pure JavaScript problem though...

/nikolaj

On 14. nov 2006, at 23:40, Israel Thompson wrote:

> I'm trying to dynamically refresh form elements on a page after making
> changes using a pop-up. i.e. A list/menu that's populated within  
> the form
> needs a new option, so the pop-up is opened then the new object is  
> added to
> the database and the pop-up is closed. The form automatically  
> refreshes the
> list/menu to reflect the new object, but the entire page is not  
> reloaded and
> any previously selected or filled in text boxes are not changed.

_____________________________________
Nikolaj de Fine Licht  •  Music&Media
Web Solutions for Cultural Businesses
http://www.musicmedia.dk



============================================
Attend the Lasso Summit
March 2-7, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Modifying forms with a POP-UP. Javascript? AJAX?

Geoff-12
The simplest way I have found to do this (and it works well) is  
simply adding an action to the button, link, field, dropdown etc: in  
the popup page and use:-

onChange="this.form.submit();window.opener.refresh()"

The popup form is submitted, the response page has:

<meta http-equiv="refresh" content="0;URL=[Referrer_URL]">

to return the popup with the new values and the opening page then  
refreshes to reflect the updated data.

If you want the popup to close and then refresh the opening page, use  
something like:

<input name="Button" type="button" onClick="window.opener.refresh
();self.close();" value="Close Window">

Hope this is of some use,

Geoff


On 15/11/2006, at 12:59 PM, Nikolaj de Fine Licht wrote:

> Israel,
>
> Can you post some code, just some representative sample code of  
> what you want to do? Its hard to imagine why you don't get your  
> page reload and/or updated data without seeing what you do. It  
> sounds like a pure JavaScript problem though...
>
> /nikolaj
>
> On 14. nov 2006, at 23:40, Israel Thompson wrote:
>
>> I'm trying to dynamically refresh form elements on a page after  
>> making
>> changes using a pop-up. i.e. A list/menu that's populated within  
>> the form
>> needs a new option, so the pop-up is opened then the new object is  
>> added to
>> the database and the pop-up is closed. The form automatically  
>> refreshes the
>> list/menu to reflect the new object, but the entire page is not  
>> reloaded and
>> any previously selected or filled in text boxes are not changed.
>
> _____________________________________
> Nikolaj de Fine Licht  •  Music&Media
> Web Solutions for Cultural Businesses
> http://www.musicmedia.dk
>
>
>
> ============================================
> Attend the Lasso Summit
> March 2-7, 2007 in Fort Lauderdale, FL
> http://www.LassoSummit.com/
> ============================================
>
> ------------------------------
> Lasso Support: http://support.omnipilot.com/
> Search the list archives: http://www.listsearch.com/lassotalk.lasso
> Manage your list subscription: http://www.listsearch.com/ 
> lassotalk.lasso?manage


============================================
Attend the Lasso Summit
March 2-7, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Modifying forms with a POP-UP. Javascript? AJAX?

Jonathan Vanherpe (T & T NV)
In reply to this post by Israel Thompson
Israel Thompson wrote:

> Hello everyone,
>
> I'm trying to dynamically refresh form elements on a page after making
> changes using a pop-up. i.e. A list/menu that's populated within the form
> needs a new option, so the pop-up is opened then the new object is added to
> the database and the pop-up is closed. The form automatically refreshes the
> list/menu to reflect the new object, but the entire page is not reloaded and
> any previously selected or filled in text boxes are not changed.
>
> Can someone point me in the right direction?
>
> Much thanks,
>
> Israel Thompson

If you already have the code in place to refresh the form, you just need
to use this code in the popup to call the function when the popup is closed:

<body onunload="self.opener.ajaxfunction();">

ajaxfunction() is the function that you wrote/have to write to refresh
your data, and it should be defined on the parent page (the one with the
form).

Jonathan

--
Jonathan Vanherpe
Tallieu & Tallieu
[hidden email]

============================================
Attend the Lasso Summit
March 2-7, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Modifying forms with a POP-UP. Javascript? AJAX?

Jolle Carlestam
In reply to this post by Israel Thompson
I have that working using javascript.

Basically I set a javascript var 'changeValue' using a Lasso date as  
a timestamp on the original page. This is to prevent a page reload  
should the user navigate to another page while the popup is open.

When the popup editing is finished it sends the result to the server  
and do whatever updating needed. In the page that's sent back to the  
popup window I have a javascript triggered by onload that sends a  
request to the original page and then closes itself. The request runs  
a javascript on the original page that checks that changeValue is  
present and not altered and if that is true it simply reloads the page.

That's all that's to it!

HDB
JC

14 nov 2006 kl. 23.40 skrev Israel Thompson:

> Hello everyone,
>
> I'm trying to dynamically refresh form elements on a page after making
> changes using a pop-up. i.e. A list/menu that's populated within  
> the form
> needs a new option, so the pop-up is opened then the new object is  
> added to
> the database and the pop-up is closed. The form automatically  
> refreshes the
> list/menu to reflect the new object, but the entire page is not  
> reloaded and
> any previously selected or filled in text boxes are not changed.
>
> Can someone point me in the right direction?
>
> Much thanks,
>
> Israel Thompson
>
>
> ============================================
> Attend the Lasso Summit
> March 2-7, 2007 in Fort Lauderdale, FL
> http://www.LassoSummit.com/
> ============================================
>
> ------------------------------
> Lasso Support: http://support.omnipilot.com/
> Search the list archives: http://www.listsearch.com/lassotalk.lasso
> Manage your list subscription:
> http://www.listsearch.com/lassotalk.lasso?manage


============================================
Attend the Lasso Summit
March 2-7, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Modifying forms with a POP-UP. Javascript? AJAX?

Israel Thompson
Thanks everyone for your replies!

I assumed it was something that had to be done in Javascript/AJAX, but I
wasn't sure how. I'll give it a try with the examples you gave. If anyone
else has some examples they'd like to post please do so. Even if it's
pointing me to a url.

Thanks,

Israel


============================================
Attend the Lasso Summit
March 2-7, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Modifying forms with a POP-UP. Javascript? AJAX?

Israel Thompson
Hello all,

Does anyone else have any samples of how to do this?

Here's my scenario. I have a parent page that contains a form with various
list/menus and text boxes. When a choice is not available in one of the
list/menus I have a link where the user can click to add a new record (that
will fit into the list/menu). Basically I want the link to open up a popup
window where I can submit the new record. Once the form on the popup is
submitted I want the popup to close and the "opener" page to be refreshed to
have new records in its list/menus.

Now to go even further it would be nice to not actually refresh the whole
page, but only refresh the form items that need to be refreshed, but I bet
that's another can of worms!

Thanks,

Israel

Here's my failed start:


-------PARENT PAGE-------

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Untitled Document</title>
 
<script type="text/javascript">
//global variable for subwindow reference
var newWindow;
//generate and fill the new window
function makeNewWindow() {
 
//make sure it isn't already opened
if (!newWindow || newWindow.closed) {
newWindow = window.open("popup.lasso","sub","status,height=200,width=300");
//delay writinig until window exists in IE/Windows
} else if (newWindow.focus) {
//window is already open and focusable, so bring it to the front
newWindow.focus();
}
}
</script>

</head>
<body>
<form name="Parent">
<input name="test1">
<input type="button" value="Create New Window" onclick="makeNewWindow();"
/>
</form>
</body>
</html>


-------POPUP PAGE-------

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Untitled Document</title>
</head>
 
<body>
 
<form name="Test">
 
<input name="test1" type="text" />
 
<input type="button" value="button"
onClick="opener.document.forms["Parent"].test1.value =
document.forms["test1"].Test.value;window.close()">
 
</form>
 
</body>
</html>


============================================
Attend the Lasso Summit
March 2-7, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Modifying forms with a POP-UP. Javascript? AJAX?

Jolle Carlestam
I do a popup/part refresh on a site where admin users can edit  
content on pages. If in admin mode they can click on an article. That  
opens an edit window where they can edit the article. In the edit  
window they have two choices. Save or Preview. (Actually also  
Cancel.) If they click Preview the edited content is sent back to a  
javascript on the original page that replaces only the article with  
the edited content. No server negotiation takes place.
If they Save the edited content is sent to the server and put into  
the DB. If that is successful the response triggers a javascript that  
closes the edit window and refresh the entire original window. I  
suppose I could only have the article refreshed. Just didn't see the  
need for that at the time.

There's a check performed too that ensures that the original window  
is still the same. That's to not refresh a window if the user went  
somewhere else in the original window before saving the edited article.

Piece of cake.

HDB
JC

13 dec 2006 kl. 21.15 skrev Israel Thompson:

> Hello all,
>
> Does anyone else have any samples of how to do this?
>
> Here's my scenario. I have a parent page that contains a form with  
> various
> list/menus and text boxes. When a choice is not available in one of  
> the
> list/menus I have a link where the user can click to add a new  
> record (that
> will fit into the list/menu). Basically I want the link to open up  
> a popup
> window where I can submit the new record. Once the form on the  
> popup is
> submitted I want the popup to close and the "opener" page to be  
> refreshed to
> have new records in its list/menus.
>
> Now to go even further it would be nice to not actually refresh the  
> whole
> page, but only refresh the form items that need to be refreshed,  
> but I bet
> that's another can of worms!
>
> Thanks,
>
> Israel
>
> Here's my failed start:
>
>
> -------PARENT PAGE-------
>
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <meta http-equiv="Content-Type" content="text/html;  
> charset=ISO-8859-1" />
> <title>Untitled Document</title>
>
> <script type="text/javascript">
> //global variable for subwindow reference
> var newWindow;
> //generate and fill the new window
> function makeNewWindow() {
>
> //make sure it isn't already opened
> if (!newWindow || newWindow.closed) {
> newWindow = window.open
> ("popup.lasso","sub","status,height=200,width=300");
> //delay writinig until window exists in IE/Windows
> } else if (newWindow.focus) {
> //window is already open and focusable, so bring it to the front
> newWindow.focus();
> }
> }
> </script>
>
> </head>
> <body>
> <form name="Parent">
> <input name="test1">
> <input type="button" value="Create New Window"  
> onclick="makeNewWindow();"
> />
> </form>
> </body>
> </html>
>
>
> -------POPUP PAGE-------
>
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <meta http-equiv="Content-Type" content="text/html;  
> charset=ISO-8859-1" />
> <title>Untitled Document</title>
> </head>
>
> <body>
>
> <form name="Test">
>
> <input name="test1" type="text" />
>
> <input type="button" value="button"
> onClick="opener.document.forms["Parent"].test1.value =
> document.forms["test1"].Test.value;window.close()">
>
> </form>
>
> </body>
> </html>
>
>
> ============================================
> Attend the Lasso Summit
> March 2-7, 2007 in Fort Lauderdale, FL
> http://www.LassoSummit.com/
> ============================================
>
> ------------------------------
> Lasso Support: http://support.omnipilot.com/
> Search the list archives: http://www.listsearch.com/lassotalk.lasso
> Manage your list subscription:
> http://www.listsearch.com/lassotalk.lasso?manage


============================================
Attend the Lasso Summit
March 2-7, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Modifying forms with a POP-UP. Javascript? AJAX?

Israel Thompson
JC,

After pulling my hair out today you're reply made my mouth water. A faint
glimmer of hope arises within me :P

Would you be so kind as to give me a little help with some sample code of
what you're talking about? I would greatly appreciate it!

Thanks,

Israel


============================================
Attend the Lasso Summit
March 2-7, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Modifying forms with a POP-UP. Javascript? AJAX?

charles brisson
Hi Israel,

The following would add 'kiwi' to the list of options:

<script type="text/javascript">
function insertOption()
  {
  var y=document.createElement('option');
  y.text='Kiwi'
  var x=document.getElementById("mySelect");
  try
    {
    x.add(y,null); // standards compliant
    }
  catch(ex)
    {
    x.add(y); // IE only
    }
  }
</script>
</head>
<body>

<form>
<select id="mySelect">
  <option>Apple</option>
  <option>Pear</option>
  <option>Banana</option>
  <option>Orange</option>
</select>
<input type="button" onclick="insertOption()"
value="Insert option" />
</form>

Work with a window.opener.document [formName][selectName] to change on
the fly the select on the page that opened your pop-up. No refreshed
needed.

charles

Israel Thompson wrote:

>JC,
>
>After pulling my hair out today you're reply made my mouth water. A faint
>glimmer of hope arises within me :P
>
>Would you be so kind as to give me a little help with some sample code of
>what you're talking about? I would greatly appreciate it!
>
>Thanks,
>
>Israel
>
>
>============================================
>Attend the Lasso Summit
>March 2-7, 2007 in Fort Lauderdale, FL
>http://www.LassoSummit.com/
>============================================
>
>------------------------------
>Lasso Support: http://support.omnipilot.com/
>Search the list archives: http://www.listsearch.com/lassotalk.lasso
>Manage your list subscription:  
>http://www.listsearch.com/lassotalk.lasso?manage
>
>  
>

============================================
Attend the Lasso Summit
March 2-7, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Modifying forms with a POP-UP. Javascript? AJAX?

Jolle Carlestam
In reply to this post by Israel Thompson
13 dec 2006 kl. 22.15 skrev Israel Thompson:

> JC,
>
> After pulling my hair out today you're reply made my mouth water. A  
> faint
> glimmer of hope arises within me :P
>
> Would you be so kind as to give me a little help with some sample  
> code of
> what you're talking about? I would greatly appreciate it!

Water your mouth do I...

Hm, see what I can extract that's comprehensible. And eatable.

Here's the script in the original page (let's call that orPage from  
now on). it reloads if it's still the same page:

<!--
function jina_reload(cv) { // a jina function v 1.1 2006-10-19
        if (cv.length > 0) {
                if($('checkValue') && (cv == $F('checkValue'))) {
                        location.reload();
                        }
                }
        else {
                location.reload();
                }
        }
//-->
</script>
The else part is for older code used in some parts that don't include  
a checkValue.
On the stub page I set a var checkValue to a date stamp:
(date_format: (date), -format='%q')
Somewhere on the orPage I put a hidden field with id="checkValue" and  
as value I use $checkValue.

On the popup page (calling it popPage) the script calling jina_reload  
is included in the result sent back in case of a successful update.  
It looks like this:

function sendReload(cv) {
   opener.jina_reload(cv);
}

It's called by an onload action that's built like this:
var:'bodytagOnLoad' = 'onload="sendReload
(\'' (action_param:'checkValue') '\'); window.close()"';

This var is put into the body tag like this:
<body onload="[var:'bodytagOnLoad']">

To reload only a part of the orPage, happens when user want's to  
preview the edited content, I have this script in the orPage:
function jina_preView(c,d,cv) { // a jina function v 1.0 2006-10-19
        if(($(d)) && (cv == $F('checkValue'))) {
                $(d).innerHTML = c;
        }else { alert('Original page changed. Preview no longer possible.') }
  window.focus();
        }

This is triggered by a button on the popPage:
<input type="button" value="Preview" onclick="javascript:sendResult
('content','articelBeta')" />

And the script in popPage looks like this:
function sendResult(aid,td) { //a jina function v 1.0 2006-10-19
        // aid = id pointing to the text area. Content that should be sent  
to the original page
        // td = id of the target div on the original page
        tinyMCE.triggerSave();
        var c = $F(aid);
        var cv = $F('checkValue');
        opener.jina_preView(c,td,cv);
        }

Finally, I think, the popup page is called by this:
<form id="jina_Alpha" action="javascript:jina_openWindow('/
Publicering/?
action=editWeb&amp;page=7F00000118dae11A29JkH22DB12F&amp;articelID=artic
elAlpha&amp;checkValue=20061214064300','JinaPopup','status=yes,scrollbar
s=auto,resizable=yes,width=850,height=650')">

The URL is built like this:

        '<form id="jina_Beta" action="javascript:jina_openWindow(\'';
        $sitePath;
        'Publicering/?action=editWeb&amp;page=';
        $webBeta_id;
        '&amp;articelID=articelBeta&amp;checkValue=';
        $checkValue;
        '\',\'JinaPopup\',
\'status=yes,scrollbars=auto,resizable=yes,width=850,height=650\')">';

(Yes, I know articel is misspelled. It's some sort of mix of English  
and Swedish. Turns out that Lasso or the browsers don't care...)

----
I've been interupted about five times and forced to do other stuff  
while writing this mail so my original thoughts and plans are long  
forgotten. I no longer have any idea of what my intentions where or  
if I lived up to them. If you find logical holes in the above,  
there's an explanation for it (Senile writer). If so, I'm sure I'll  
get to know about it.

What was the question again?

HDB
JC

============================================
Attend the Lasso Summit
March 2-7, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
12