timmy Posted January 17, 2001 Posted January 17, 2001 This is probably more of an HTML question than a CDML one. But here goes: I want to display a popupmenu in my page, that lists out the values in a field in FMPro. When any item of this list is selected, it will link to a url. Does anyone have any example code? I can make the popupmenu easily. The linking is giving me trouble. Thanks in advance.
Keith M. Davie Posted January 17, 2001 Posted January 17, 2001 <a href="[fmp-field:urlstorage]">xxx</a> Peace Keith M. Davie
timmy Posted January 17, 2001 Author Posted January 17, 2001 right, but how does that work with this stuff: <select size=4 name="Country"> <option value="F1" selected>France <option value="G7">Germany <option value="I4">Iceland <option value="U2">USA </select> Maybe I'm thinking about this all wrong. I want this menu to work similar to the "Hop To" list on the bottom of these forum pages. Thanks again.
yafreax Posted January 17, 2001 Posted January 17, 2001 in the head of the html insert the following javascript: <SCRIPT LANGUAGE="JavaScript"><!-- Begin function formHandler(form){ var URL = document.form.site.options[document.form.site.selectedIndex].value; window.location.href = URL; } // End --></SCRIPT> then insert this where ever you want the popup menu. <CENTER><FORM ACTION="" METHOD=POST name=form> <CENTER><SELECT NAME=site onchange="javascript:formHandler()"> <OPTION VALUE=" ">Please Select . . . <OPTION VALUE="URL TO HOP TO HERE">France </SELECT></CENTER> </FORM></CENTER> and follow that format for the rest of the links. That however, is not going to give you a value in your FM field. So that may not be what you are looking for. If you want it to actually put the value in the field, well, you are going to need an action tag such as -new or -edit assigned to a button. jeremy
dspires Posted January 17, 2001 Posted January 17, 2001 This code will jump to the associated Country_URL value when it is chosen in the pop-up list. This doesn't require the 'go' button. <SELECT NAME="Country" onChange="if(this.options[this.selectedIndex].value!='$'){window.open(this.options[this.selectedIndex].value,'_self')}"> <option VALUE="$" selected>Country <option VALUE="$">--------------- > [FMP-valuelist: Country_URL] <option VALUE="[FMP-valuelistitem]"> [FMP-valuelistitem] [/FMP-valuelist] </SELECT>
yafreax Posted January 17, 2001 Posted January 17, 2001 Just so you know, the one i use doesn't require a go button, either. It just goes, i'm sure your's work just fine .
timmy Posted January 22, 2001 Author Posted January 22, 2001 How do I alter the text of the pop up menu's for either one of the JavaScript solutions posted? Thanks, Tim. [This message has been edited by timmy (edited January 22, 2001).]
yafreax Posted January 23, 2001 Posted January 23, 2001 to edit the options that will display, substitute the text after the closing bracket , ">" , of the option line. For example, in the script i posted, where it says france, you would copy and paste that line as many time as needed replacing "France" with the text that you want displayed, (i.e. - "yahoo.com"). And replace the "URL TO HOP TO HERE" with the COMPLETE URL (i.e. - "http://www.yahoo.com"). also, javascript is picky about how the information in the head is typed so make sure that the breaks are where they are above. hope this answers your question. jeremy
timmy Posted January 25, 2001 Author Posted January 25, 2001 Are there any problems with this code and IE or Netscape? Does it work fine in both? [This message has been edited by timmy (edited January 25, 2001).]
yafreax Posted January 26, 2001 Posted January 26, 2001 i haven't seen any problems with it, the best thing to do is test. . . BUT in some cases, the user has altered the browser preferences and javascript will not work. But this usually isn't the case b/c javascript has a high volume usage and most users don't ever mess with their browswer preferences unless they are A. stupid and want to play, then there is no hope anyway. or B. they are advanced users and would probably never have a reason to turn javascript off. (note, not all browsers, maybe not even most, have this option.) and of course, everynow and then the browser application is corrupt and it won't do anything with javascript. I have seen this most often on IE 4.x for Macs Over all i'd say your pretty safe for using it. jeremy [This message has been edited by yafreax (edited January 26, 2001).]
Anatoli Posted January 27, 2001 Posted January 27, 2001 You can do alternative any HTML code <noscript> HTML code when JS is off </noscript>
Recommended Posts
This topic is 8770 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now