If you want to change the selected item on the picker depending on the
click of a picture, you’ll need to use some JavaScript. In order to
wire up the page to respond in this way, you’ll need to add some more
identifiers to your page elements through the Item / Extended menu item.
For each of your pictures, add an ID attribute to the image that
exactly matches the value one of the options in your picking list. So
the president should get the id ‘pres’ (without the quotes).
Click once on the image, select Item / Extended from the main menu,
click New, enter id in the Name field and pres in the Value field.
Also add a class to the image so you don’t have to listen to clicks on
all images – just the ones you care about. Click New again, then
enter class in the Name field and picker in the Value field. Okay out
of the dialog. Repeat for each image, making sure that no two images
have the same ID (IDs must be page-unique in all cases).
For your picking list, you need to add an ID so that your script can
find it. Click on the picker, choose Item / Extended, make sure you
have the select segment chosen in the top of the dialog, and press
New. Enter id in the Name field and position in the Name field. (It’s
a good idea to use the same value for the name and id attribute on
form elements, since IE gets very easily confused otherwise.)
Now for the script itself. Apply the Protaculous Action to the page,
and make sure that prototype-packed is chosen in the Library picker in
the Actions palette. Click on the top Function Body button. In the
dialog that appears, paste the following code:
$$('img.picker').invoke('observe','click',function(evt){
$('position').setValue(this.id);
});
Publish and test it out. If it doesn’t work, look at it in Firefox
with the Firebug extension enabled and see what is listed in the
console.
If you want the click to also bring the rest of your form into view
(to scroll the page) then you can change the function to read thus:
$$('img.picker').invoke('observe','click',function(evt){
$('position').setValue(this.id).focus();
});
And the page will scroll down to show the Position picker and
highlight it in the browser when the image is clicked, so the next
action should be evident to your visitor.
To make the browser show a “this is clickable” cursor on these photos,
you can add a CSS style rule to the page using the Styles palette. Get
the New Style dialog open, and in the Tag field enter img.picker and
tab into the Name field and delete whatever is there and then tab back
out to make it “set”. Now click the Extended button, and New, and
enter cursor in the Name field and pointer in the Value field. Okay
out of the stack of dialogs (make sure Freeway didn’t sneak a style
name into the Name field while you weren’t looking).
Now you don’t need to add this style to the page – because it has a
Tag but no Name, it will always publish. If it matches any elements on
the page (which this should) then it will take effect (showing the
click me click me pointing finger while the mouse is over one of the
photos).
Walter
On Mar 27, 2010, at 2:04 PM, Beatrice wrote:
I have this contact page and was wondering if it would be difficult
to have the image click (position/person) correspond to the Position
at the bottom of the contact form.
http://nkbaga.org/contact.php
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options