close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

'Populate List from Array' on page load

Thread began 8/11/2013 3:46 am by info4753 | Last modified 8/14/2013 9:38 am by info4753 | 3140 views | 9 replies |

info4753

'Populate List from Array' on page load

Is it possible to 'Populate List from Array' on a page load event (together with onChange of parent list1)?

I have a list of buttons on one page which submit IDs of list1 and IDs of list2 as GET parameters. On the form page the list2 values are populated by onChange event of its parent list1.

Now I want the list2 values also shown and selected by its submitted ID, when the page loads. Otherwise the user has to select the values again (which he already has by selecting the button of the first pasge).

Thanks for any help.

Sign in to reply to this post

Jason ByrnesWebAssist

yes, you can add the Populate list from array behavior to the body unload event.

first you will need to create the URL Variable bindings. on the bindings panel, click the plus button, select URL Variable and name the bindings.

The in the Dreamweaver tag selector, select the Body tag and then add the Populate list from array behavior. you will also want to use the Set Selected in list behavior to use the URL Variable bindings to set the list selected value.

Sign in to reply to this post

info4753

Thank you so much Jason. Perfect support!

Sign in to reply to this post

Jason ByrnesWebAssist

You're welcome.

Sign in to reply to this post

info4753

This post has been deleted.

info4753

Is "Set Selected in list " only working with URL variables? I tried to do this with Session variables, but it's not working...

Sign in to reply to this post

Jason ByrnesWebAssist

It should work with sessions as well, you may need to add a session start command line of the page to force it to see the session:

php:
<?php @session_start(); ?>



when in doubt, add the session binding to the body of the page to double check that it is returning a value.

Sign in to reply to this post

info4753

The Session returns the correct value. Here is the onLoad statement:

WA_setSelectionsInChildList(MM_findObj('Sitzungszimmer'),<?php echo $_SESSION['Sitzungszimmer']; ?>);WA_FilterAndPopulateSubList(rsBestuhlung_WAJA,MM_findObj('Sitzungszimmer'),MM_findObj('Bestuhlung'),0,0,false,': ');WA_FilterAndPopulateSubList(rsDauer_WAJA,MM_findObj('Sitzungszimmer'),MM_findObj('Dauer'),0,0,false,': ');WA_setSelectionsInChildList(MM_findObj('Dauer'),<?php echo $_GET['Dauer']; ?>);WA_setSelectionsInChildList(MM_findObj('Bestuhlung'),<?php echo $_GET['Bestuhlung']; ?>);WA_FilterAndPopulateSubList(rsVeranstaltungVon_WAJA,MM_findObj('Dauer'),MM_findObj('EventVon'),0,0,false,': ');WA_FilterAndPopulateSubList(rsVeranstaltungBis_WAJA,MM_findObj('Dauer'),MM_findObj('EventBis'),0,0,false,': ')

If I use <?php echo $_GET['Sitzungszimmer']; ?> instead of <?php echo $_SESSION['Sitzungszimmer']; ?> it works. This is the "master-value"
that makes all other lists poulate.

Another problem is, if one of the other GET parameter is emtpy or missing, none of the lists is being populated.

Sign in to reply to this post

Jason ByrnesWebAssist

if you add:

php:
||<?php echo $_GET['Sitzungszimmer']; ?>||<?php echo $_SESSION['Sitzungszimmer']; ?>||



to the body of the page, what does that return?

If one of the get variables is missing is wouldn't expect it to work, there is no way for it to know what is selectedf in the parent list, etc...

you could force a default value using isset if you like, for example:

php:
<?php echo((isset($_GET['Sitzungszimmer'])?$_GET['Sitzungszimmer']:1); ?>



this will use the value of the GET Variable if it exists or 1 if not.

Sign in to reply to this post

info4753

I made a stupid type error, arghh ... $_SESSION['sessSitzungszimmer'] is correct not $_SESSION['Sitzungszimmer']

Sorry for that, and thanks for your efforts.

I'll try the default value idea. Thanks Jason!

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...