Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    New Coder
    Join Date
    Nov 2010
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Input button to text link

    Hi all,

    I am working with a php code that I am trying to edit a bit. The last part I am trying to change I cannot figure out.

    Essentially I want to change the "Login" submit button to just a text link that says "Login" instead.

    <form action="<?php echo JRoute::_( 'index.php', true, $params->get('usesecure')); ?>" method="post" name="login" id="form-login" >
    <?php echo $params->get('pretext'); ?>

    <input id="modlgn_username" type="text" name="username" class="inputbox" alt="username" size="15" value="<?php echo JText::_('Username') ?>" onclick="login.username.value='';" />&nbsp;
    <input id="modlgn_passwd" type="password" name="passwd" class="inputbox" size="15" alt="password" value="<?php echo JText::_('Password') ?>" onclick="login.passwd.value='';" />&nbsp;



    <?php if(JPluginHelper::isEnabled('system', 'remember')) : ?>

    <label for="modlgn_remember"><?php echo JText::_('Remember me') ?></label>
    <input id="modlgn_remember" type="checkbox" name="remember" class="inputbox" value="yes" alt="Remember Me" />&nbsp;

    <?php endif; ?>
    <input type="submit" name="Submit" class="button" value="<?php echo JText::_('LOGIN') ?>" />&nbsp;



    <?php
    I am hoping this is just a minor change. Would someone mind showing me what I have to do?

    Thanks very much.

  • #2
    Regular Coder poyzn's Avatar
    Join Date
    Nov 2010
    Posts
    266
    Thanks
    2
    Thanked 61 Times in 61 Posts
    <a href="#" onclick="this.form.submit();">Login</a>

  • #3
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,468
    Thanks
    278
    Thanked 32 Times in 31 Posts
    only my preference i prefer to show a dead link on something like that..

    <a href="javascript:void(0);" onclick="this.form.submit();">Login</a>

  • #4
    New Coder
    Join Date
    Nov 2010
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks guys.

    Do I just replace the entire line of code that I bolded with your code?

    I tried doing that and it stopped working. Do I need to place your code somewhere inside the bolded code?

    Thanks.

  • #5
    New Coder
    Join Date
    Nov 2010
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Hey guys -

    Any help here? Maybe I need to change the "this.form.submit" part of it?

    Thanks.

  • #6
    Regular Coder poyzn's Avatar
    Join Date
    Nov 2010
    Posts
    266
    Thanks
    2
    Thanked 61 Times in 61 Posts
    just replace the bolded code with it. by the way where is the closing form tag?

  • #7
    New Coder
    Join Date
    Nov 2010
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Something seems to be missing, because when I simply replace the bolded code above with one of the two suggestions, I cannot login anymore.

    Here is the full code:
    Code:
    <form action="<?php echo JRoute::_( 'index.php', true, $params->get('usesecure')); ?>" method="post" name="login" id="form-login" >
    	<?php echo $params->get('pretext'); ?>
    
    	<input id="modlgn_username" type="text" name="username" class="inputbox" alt="username" size="15" value="<?php echo JText::_('Username') ?>" onclick="login.username.value='';" />&nbsp;
    		<input id="modlgn_passwd" type="password" name="passwd" class="inputbox" size="15" alt="password" value="<?php echo JText::_('Password') ?>" onclick="login.passwd.value='';" />&nbsp;
            
           
    
    <?php if(JPluginHelper::isEnabled('system', 'remember')) : ?>
    	
    		<label for="modlgn_remember"><?php echo JText::_('Remember me') ?></label>
    		<input id="modlgn_remember" type="checkbox" name="remember" class="inputbox" value="yes" alt="Remember Me" />&nbsp;
    	
    	<?php endif; ?>
    	<a href="#" onclick="this.form.submit();">Login</a>&nbsp;
    
    
    		
    <?php
    		$usersConfig = &JComponentHelper::getParams( 'com_users' );
    		if ($usersConfig->get('allowUserRegistration')) : ?>
    	
    			<a href="<?php echo JRoute::_( 'index.php?option=com_user&task=register' ); ?>">
    				Register</a>
    		
    		<?php endif; ?>
    		
    		&nbsp;<a href="www.google.com">Help</a>		
    	
    	<?php echo $params->get('posttext'); ?>
    
    	<input type="hidden" name="option" value="com_user" />
    	<input type="hidden" name="task" value="login" />
    	<input type="hidden" name="return" value="<?php echo $return; ?>" />
    	<?php echo JHTML::_( 'form.token' ); ?>
    </form>

  • #8
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    This doesn't have anything to do with php. Moving from PHP forum to Javascript forum.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #9
    New Coder
    Join Date
    Nov 2010
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I apologize, I didn't realize. Thanks for moving.

    Any help guys?

    Thanks!

  • #10
    Senior Coder Logic Ali's Avatar
    Join Date
    Sep 2010
    Location
    London
    Posts
    1,028
    Thanks
    0
    Thanked 207 Times in 202 Posts
    Quote Originally Posted by mtdon1 View Post
    Something seems to be missing, because when I simply replace the bolded code above with one of the two suggestions, I cannot login anymore.
    Code:
    <a href="#" onclick="this.form.submit();">Login</a>
    You should use the error console. A link is not a form element so this cannot be used to reference the form.

    Code:
    <a href="#" onclick="document.getElementById('form-login').submit();">Login</a>
    Although you must realise that this is inoperable if JS is not available.

    You could submit with an image-type element:
    Code:
    <input type='image' src='An_Image_That_Looks_Like_A_Link.gif'>

  • #11
    New Coder
    Join Date
    Nov 2010
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Perfect. It works. I knew I must need to include the form ID somehow.

    Thanks a bunch for your help!

  • #12
    New Coder
    Join Date
    Nov 2010
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Hey guys -

    I need a little more help with this one. I forgot about the "Logout" button too! It seems to be a bit different from the login section, that's why I am asking. Again, I would like this to be a text link, not a button.

    Code:
    <div id="jtphorzlogin">
    <?php if($type == 'logout') : ?>
    <form action="index.php" method="post" name="login" id="form-login">
    <?php if ($params->get('greeting')) : ?>
    	
    	<?php if ($params->get('name')) : {
    		echo JText::sprintf( 'HINAME', $user->get('name') );
    	} else : {
    		echo JText::sprintf( 'HINAME', $user->get('username') );
    	} endif; ?>
    	
    <?php endif; ?>
    	
    		<input type="submit" name="Submit" class="button" value="<?php echo JText::_( 'BUTTON_LOGOUT'); ?>" />
    
    
    	<input type="hidden" name="option" value="com_user" />
    	<input type="hidden" name="task" value="logout" />
    	<input type="hidden" name="return" value="<?php echo $return; ?>" />
    </form>

    Thank you!

  • #13
    New Coder
    Join Date
    Nov 2010
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Any ideas here?

    Thanks!

  • #14
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,596
    Thanks
    80
    Thanked 4,633 Times in 4,595 Posts
    ??? How is this any different???

    Code:
    <a href="#" onclick="document.getElementById('form-logout').submit();">Logout</a>
    Assuming you have <form id="form-logout"> of course.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #15
    New Coder
    Join Date
    Nov 2010
    Posts
    26
    Thanks
    1
    Thanked 0 Times in 0 Posts
    This doesn't seem to work. I also have lost the ability to just hit "Enter" and have the login submitted.

    I have to actually click on the link.


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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