with (Event.Behavior)

0 views
Skip to first unread message

tali-aviram

unread,
Nov 22, 2009, 4:25:49 AM11/22/09
to LivePipe UI Users
I am trying to use event_behavior.js :
I have option-list with two options:
for each option I want to show different option-list.
as the example in livepipe site for 'Starting Simple' country and
states.
but when I choose the option the other list-option is not SHOW?

Please help!!!!!
what am I missing?

my code:
<head>
<script src="js/lib/prototype.js" type="text/javascript"></script>
<script src="js/lib/livepipe.js" type="text/javascript"></script>
<script src="js/lib/event_behavior.js" type="text/javascript"></
script>
<script type="text/javascript">
document.observe('dom:loaded',function(){
with(Event.Behavior){
show('state_field').when('country').is('United
States');
show('province_field').when('country').is('Canada');
}
});
</script>
</head>
<body >
<div style="float:left;">
<div class="label">Country</div>
<select id="country">
<option>United States</option>
<option>Canada</option>
<option>Luxembourg</option>
</select>
</div>
<div style="float:left;" id="state_field" >
<div class="label">State</div>
<select id="state">
<option>Ohio</option>
<option>Michigan</option>
<option>Kentucky</option>
</select>
</div>
<div style="float:left;" id="province_field">
<div class="label">Province</div>
<select id="Province">
<option>British Columbia</option>
<option>Ontario</option>
<option>Saskatchewan</option>
</select>
</div>
</body>

nlloyds

unread,
Nov 22, 2009, 2:12:27 PM11/22/09
to LivePipe UI Users
@tali-aviram,

The code you posted worked for me. I had to change a couple of line
breaks, but I think that's because of the way google groups formatted
it (a gist works better of this sort of post.)

The behaviors like this also invoke the opposite behavior, so

show('province_field').when('country').is('Canada');

Also, in effect, invokes:

hide('province_field').when('country').is_not('Canada');

The line breaks that messed me up initially didn't cause any errors in
Firefox, but did show up on the Safari web inspector console, so try
that.

Hope that helps.

Nathan

Tali Aviram

unread,
Nov 23, 2009, 1:59:43 AM11/23/09
to livepipe...@googlegroups.com
line breaks you mean:
<br/> ?
add them?
thanks for help.
Tali


--

You received this message because you are subscribed to the Google Groups "LivePipe UI Users" group.
To post to this group, send email to livepipe...@googlegroups.com.
To unsubscribe from this group, send email to livepipe-ui-us...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/livepipe-ui-users?hl=.





--
Tali Aviram

Tali Aviram

unread,
Nov 23, 2009, 4:45:21 AM11/23/09
to livepipe...@googlegroups.com
which line breaks you mean?

On Sun, Nov 22, 2009 at 9:12 PM, nlloyds <nll...@gmail.com> wrote:
--

You received this message because you are subscribed to the Google Groups "LivePipe UI Users" group.
To post to this group, send email to livepipe...@googlegroups.com.
To unsubscribe from this group, send email to livepipe-ui-us...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/livepipe-ui-users?hl=.





--
Tali Aviram

tonypm

unread,
Nov 25, 2009, 7:24:09 AM11/25/09
to LivePipe UI Users
Hi,

I have just copied and pasted your code into one of my test apps,
loading only the same three js files and it ran fine. (I did need to
connect the United States line together, but otherwise it is exactly
as you pasted here).

I can only suggest you check in firebug that the js files have loaded
ok, and also make sure your html is valid.

Tonypm

Tali Aviram

unread,
Nov 26, 2009, 2:51:16 AM11/26/09
to livepipe...@googlegroups.com
This is so weird!!!
I have the same code as I send, I don't have any error in firebug nor exceptions when I debug it.

I saw now while debugging that for each change it only doing the Hide function as
Nathan said at first
and even once it did not enter the show function.

Does any one knows why???

Nathan Can you explain again about the breaks you talked about?

Please Tali...



--

You received this message because you are subscribed to the Google Groups "LivePipe UI Users" group.
To post to this group, send email to livepipe...@googlegroups.com.
To unsubscribe from this group, send email to livepipe-ui-us...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/livepipe-ui-users?hl=en.





--
Tali Aviram

nlloyds

unread,
Nov 27, 2009, 1:19:03 PM11/27/09
to LivePipe UI Users
Tali,

On Nov 26, 1:51 am, Tali Aviram <tavi...@gmail.com> wrote:
> Nathan Can you explain again about the breaks you talked about?

All I meant was that when I copied an pasted from your group posting,
some of the line breaks broke the script. For example, the </script>
got broke and made in </{NEWLINE}script>, which caused firefox to not
run the script. Whatever you originally had probably didn't have these
problems, and it ran fine for me, so I'm not sure what the problem is.

Nathan
Reply all
Reply to author
Forward
0 new messages