Results 1 to 11 of 11

Thread: Button As A Href

  1. #1
    Join Date
    Feb 2006
    Springfield, MO

    Button As A Href

    I am trying to use buttons on a page to call other pages. I accomplish (in firefox at least) this by making the button an <a href> tag. The buttons are within a form that does have a submit button as well however these link buttons are not submitting any info.

    Guess where I am thrown off is that it works in firefox but not ie.

    any help would be cool.

    <td><img src="images/new_globe.gif"></td>
    <td><img src="images/header2.gif"></td>
    <%'determine if this is the first visit to the page
    getCurrentHBL="SELECT * FROM tblHBL WHERE HBLID = " & hblID & ""
    set currentHBL=oCmd.execute(getCurrentHBL)
    		IF currentHBL.eof THEN
    		<form action="HBL_add_item3.asp?hblID=<%=currentHBL(0)%>" method="post">
    		<table cellpadding="4" cellspacing="4">
    		<input type="hidden" name="hblID" value="<%=currentHBL(0)%>">
    		<input type="hidden" name="customer2" value="<%=currentHBL(2)%>">
    		<input type="hidden" name="MBL" value="<%=currentHBL(18)%>">
    'Open connection with database DSNless connection string.
    Set oCmd = Server.CreateObject("ADODB.Connection")
    oCmd.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath(DatabaseFolder2) 
    'gets master bull number for display using autoID passed from previous page
    masterSQL="SELECT MasterBill FROM tblMaster WHERE MasterID = " & currentHBL(18) & ""
    set masterTemp = oCmd.execute(masterSQL)
    		<td><b>Master Bill Number</b></td>
    				<%'gets exporter information
    				expSQL="SELECT Name FROM tblExporter WHERE ExpID = " & currentHBL(1) & ""
    				set expTemp = oCmd.execute(expSQL)%>
    				<td><b>Consigned To</b></td>
    				<%'gets customer information
    				custSQL="SELECT Name FROM tblCustomer WHERE CustID = " & currentHBL(2) & ""
    				set custTemp = oCmd.execute(custSQL)%>
    				<td rowspan="9" width=120>&nbsp;</td>
    				<td rowspan="9"><p><a href="HBL_index.asp"><input type="button" name="complete1" value="Complete Master Bill"></a></p>
    				<a href="HBL_create.asp?MBL=<%=currentHBL(18)%>"><input type="button" name="complete" value="Add New HBL to Master"></a></td>
    				<td><b>Notify Party/Intermediate Consignee</b></td>
    				<td><b>Forwarding Agent</b></td>
    				<td><b>Document #</b></td>
    				<td><b>House Bill of Lading</b></td>
    				<td><b>Point(State) of Origin or FTZ Number</b></td>
    				<td><b>Type of Move</b></td>
    				<td><b>Containerized (Vessel)</b></td>
    				<td><b>Pre-Carriage by-</b></td>
    				<td><b>Exporting Carrier</b></td>
    				<td><b>Place of Receipt</b></td>
    				<td><b>Port of Loading/Export</b></td>
    				<td><b>Port of Unloading</b></td>
    				<td><b>Final Delivery</b></td>
    				<td><b>Loaded on Board</b></td>
    				<td><input type="submit" value="Add New Item" name="Submit"></td>
    		<%END IF%>
    <table border=1>
    		<td><b>P.O. #</b></td>
    		<td><b>Seal #</b></td>
    		<td><b>Container #</b></td>
    		<td><b>Container Type</b></td>
    		<td><b># of Packages</b></td>
    		<td><b>Gross Weight (in KG)</b></td>
    	'obtain all descriptions
    	getDesc="SELECT * FROM tblDescription WHERE HBL_ID = " & hblID & ""
    	set desc=ocmd.execute(getDesc)
        do until desc.eof
    <%	desc.movenext
    	set desc=nothing
    Last edited by orionbrock32; 09-19-2006 at 10:37 AM.
    Buzzards got to eat same as worms.

  2. #2
    Join Date
    May 2006
    Sydney, Australia
    You need to use a javascript event to make the page go somewhere

    <input type="button" name="complete1" value="Complete Master Bill" onClick="window.navigate('URL')">

  3. #3
    Join Date
    Mar 2006
    Vanny is correct.
    The easiest way to do this is to use Javascript.

    If you want to open the link in a different page use :

    window.open('url') instead of window.navigate('URL')

  4. #4
    Join Date
    Feb 2006
    Springfield, MO
    i found a code that worked. does this look like there would be a problem?

    <INPUT TYPE="button" name="complete1" value="Complete Master Bill" onClick="parent.location='HBL_index.asp'">
    Buzzards got to eat same as worms.

  5. #5
    Join Date
    Jun 2004
    Yes, it's completely useles for anyone who doesn't have Javascript enabled. It sounds like you might as well just style an A element to look like a button.
    Disclaimer. (1) Whilst I will help you sometimes, if I feel like it, and my advice in relation to your actual question will be of good quality: my posts are to be taken with a pinch of salt. I will be sarcastic, deploy irony and include obscure cultural references for my own amusement without warning.
    (2) You will gain nothing from complaining, and if you try to argue with me then you will not win. No matter how noble your battle seems, I am still better than you, don't be an hero.

  6. #6
    Join Date
    Feb 2006
    Springfield, MO
    is there a way to do a check and see if java script is enabled and then run an if statement like:

    IF javascript enabled THEN
    <INPUT TYPE="button" name="complete1" value="Complete Master Bill" onClick="parent.location='HBL_index.asp'">
    <a href="HBL_index.asp"> Link</a>
    END IF
    Buzzards got to eat same as worms.

  7. #7
    Join Date
    Dec 2003
    England, UK
    just use css to style an anchor the same as your form buttons.

    it's really not a good idea to overcomplicate things like your "if" would.

  8. #8
    Join Date
    Feb 2006
    Springfield, MO
    I guess that didn't look at it that way. I was trained in VB and having to learn the web stuff on my own. And they taught me in VB that you can solve anything with an IF statement
    Buzzards got to eat same as worms.

  9. #9
    Join Date
    Jan 2009
    Just because you CAN solve it with an IF statement doesn't mean you should

  10. #10
    Join Date
    Dec 2007
    Dayton, OH
    Please please please PLEASE do not use JavaScript to make a button click. That is terrible usability. ASP can not detect if JS is enabled anyways.

  11. #11
    Join Date
    Aug 2009

    No need for JavaScript for button link

    JavaScript isn't necessary to make a button work like a link. Buttons are meant to submit forms, and if the button is the only thing in the form then it has the same effect as clicking a link. E.g.:

    <form action="test.html" method="get">
    <input type="submit" value="Go To Other Page"/>

    <form action="test2.html" method="get">
    <input type="submit" value="Go To Other Other Page"/>

    (multiple forms on a single page is also valid HTML)

    One thing to be careful about is that you can't pass a query string in the `action' of a form. To construct a query string, you'd need to specify the parameters in the form. For instance, this:

    <form action="default.aspx?a=apple&amp;b=orange" method="get">
    <input type="submit" value="Go To Other Script Bad"/>

    won't have the intended effect, but this will:

    <form action="default.aspx" method="get">
    <input type="hidden" name="a" value="apple">
    <input type="hidden" name="b" value="orange">
    <input type="submit" value="Go To Other Script"/>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.14550 seconds
  • Memory Usage 2,963KB
  • Queries Executed 13 (?)
More Information
Template Usage (33):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (3)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (11)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (11)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (70):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • bbcode_parse_start
  • postbit_imicons
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates