Results 1 to 10 of 10

Thread: text box as submit button?

  1. #1
    Senior Member
    Join Date
    May 2010
    Posts
    98

    Default text box as submit button?

    Hi,

    I appreciate this is probably a html query rather than NOF, but seeing as this forum is so supportive ill ask here also

    Is there anyway to use a text box (or code entered within) to act as a submit type button assuming it is placed on a form.

    Can an onclick command be added to make it act like one?

    The reason i ask is that im trying to create a custom page navigation bar.
    Ive created a table to hold the page numbers and set this as a form.
    I would like the cell background to be an image and the text in front to be the page number.
    I just need to be able to click on the text box page number (or cell come to think of it) and it submits a value that i can then work into a php script.

    Is this possible or any other solutions?

    Regards, J

  2. #2
    Twayne
    Guest

    Default Re: text box as submit button?

    In news:jofan.4dfj2n@no-mx.forums.netobjects.com,
    jofan <jofan.4dfj2n@no-mx.forums.netobjects.com> typed:
    > Hi,
    >
    > I appreciate this is probably a html query rather than NOF,
    > but seeing as this forum is so supportive ill ask here also
    >
    >
    > Is there anyway to use a text box (or code entered within)
    > to act as a submit type button assuming it is placed on a
    > form.
    >
    > Can an onclick command be added to make it act like one?
    >
    > The reason i ask is that im trying to create a custom page
    > navigation bar.
    > Ive created a table to hold the page numbers and set this
    > as a form. I would like the cell background to be an image
    > and the text in front to be the page number.
    > I just need to be able to click on the text box page number
    > (or cell come to think of it) and it submits a value that i
    > can then work into a php script.
    >
    > Is this possible or any other solutions?
    >
    > Regards, J


    Yes, as long as you give it type Submit. Misuse can have some gotcha's
    though.
    I think what you really want to do is use a PHP "session" to pass the data;
    lots easiier.

    HTH,

    Twayne`



  3. #3
    Senior Member chuckj's Avatar
    Join Date
    Jan 2010
    Location
    www.beyondfusion.com - Florida
    Posts
    1,302

    Default

    Doesn't have to be that complicated.

    You can pass a value to your script with a simple link. You use the GET method with your script and pass the value as part of the URL pointing to the script.

    The script would have to display an HTML page or be part of one or the visitor will get a blank browser window when they click on the link.
    Last edited by chuckj; 07-02-2010 at 01:42 PM.
    Chuck Joslin
    www.BeyondFusion.com
    PHP & MySQL development with Fusion
    Fusion support for AllWebMenus (Likno) Contact me for custom AWM menus for your sites.
    Tutorials and Forums

  4. #4
    Senior Member
    Join Date
    May 2010
    Posts
    98

    Default

    Hi Twayne / Chuck

    Thanks for the reply, Ive looked into this and can only see ref to text input field rather than a text area .

    As mentioned above im trying to create a customised page navigation bar similar to 1 2 3 4 5, when the numbers are clicked on they act as a submit so they can be proceesed via script (php), so the numbers are display only - not input.

    Any example would be greatly appreciated, J
    Last edited by jofan; 07-02-2010 at 06:04 AM.

  5. #5
    Senior Member
    Join Date
    May 2010
    Posts
    98

    Default

    Ok, ive come accross this after doing a 'use text link as submit' search...

    <a href="#" onclick="document['Table3FORM'].submit()">text here</a>

    This appears to submit (the page refreshes), but im not sure how to capture this.

    Ive been using the isset function to determine the name of regular submit buttons but how would i add a name attribute to the line of code above?

    Any assistance appreciated, J

  6. #6
    Senior Member
    Join Date
    May 2010
    Posts
    98

    Default

    Even better...i think,

    I've used a css style to change the look of the standard button (added a new background image), and this works fine.

    Is this a better way to do this?

    J

  7. #7
    Twayne
    Guest

    Default Re: text box as submit button?

    Dunno who that post was meant for since it was so over-clipped there's
    nothing left of the post that was responded to. The Link method's a
    possibility too.
    If the post was to me, I disagree that the method I talked about is
    complex. Start a session, put a variable in it, use it wherever else you
    want to use the variable with another session statement. It's more secure
    and once a person spends a few minutes getting it straight what belongs on
    which side of the statements there's nothing to it.
    Overall it's just putting variables into a stack and calling for them
    from the program where you want to use them. It's also easy to kill a
    session in case someone tries to refresh their way back to re-use part of a
    form and things like that for spamming/scamming purposes.

    Some people use cookies but IMO they are somethinig to be avoided in most
    cases since so many people refuse cookies nowadays.

    The link method works well though for most cases but unless it's kept
    completely on the server it's easy to let visitor's see what's going on
    which isn't the best Security wise. GETs are often frowned upon:
    Information sent from a form with the GET method is visible to everyone
    (it will be displayed in the browser's address bar) and has limits on the
    amount of information to send (max. 100 characters).
    This method should not be used when sending passwords or other sensitive
    information! However, because the variables are displayed in the URL, it is
    possible to bookmark the page. This can be useful in some cases too.
    GET can be a valuable feature, but be sure where you're using it is
    "safe" w/r to Security for the site it's on.

    For the most part, there is nothing too "wrong" with GET; just be aware of
    its pitfalls. You can read more about the GET function and Sessions at
    www.w3schools.com or www.php.net/manual .

    My purpose here is not to denigrate links, but more to respond to the
    complexity point. I used to use GET a lot but once got into sessions,
    things became much more amenable to thiings I wanted to do, especially with
    forms and treating any kind of user input. Therefore I have a different
    opinon of the two. Likewise, other's opinions may well vary also; I'm only
    stating mine.

    HTH,

    Twayne`


    n news:chuckj.4dfxlz@no-mx.forums.netobjects.com,
    chuckj <chuckj.4dfxlz@no-mx.forums.netobjects.com> typed:
    > Doesn't have to be that complicated.
    >
    > You can pass a value to your script with a simple link. You
    > use the GET method with your script and pass the vluse as
    > part of the URL pointing to the script.
    >
    > The script would have to display an HTML page or be part of
    > one or the visitor will get a blank browser window when
    > they click on the link.
    >
    >
    >
    > CHUCK JOSLIN
    > www.BeyondFusion.com
    > PHP & MySQL development with Fusion
    > Official Fusion support for AllWebMenus (Likno Software)
    > Tutorials and Forums





  8. #8
    Twayne
    Guest

    Default Re: text box as submit button?

    In news:jofan.4dfyuz@no-mx.forums.netobjects.com,
    jofan <jofan.4dfyuz@no-mx.forums.netobjects.com> typed:
    > Hi Twayne,
    >
    > Thanks for the reply, Ive looked into this and can only see
    > ref to text input field rather than a text area that can
    > display text only.
    >
    > As mentioned above im trying to create a customised page
    > navigation bar similar to 1 2 3 4 5, when the numbers are
    > clicked on they act as a submit so they can be proceesed
    > via script (php)
    >
    > Any clarification appreciated, J


    I think I may have misunderstood exactly what you're trying to do here.
    But,
    <input type="submit" />

    as part of the command line identifies it as a submit button. Whatever
    object is being referenced there will act as a Submit button. It -sounds-
    like all you want is to have 5 submit buttons, each submitting the data to a
    different page, right? And you're apparently using a common set of data for
    each one?



    Apparently I misunderstand because it should be a minor detail to use
    multiple submit buttons for any point on the page you wish to as long as you
    intend to leave that page.



    Perhaps a ceaner, more detailed explanation would help.



    HTH,



    Twayne`





  9. #9
    Twayne
    Guest

    Default Re: text box as submit button?

    In news:jofan.4dgpnz@no-mx.forums.netobjects.com,
    jofan <jofan.4dgpnz@no-mx.forums.netobjects.com> typed:
    > Ok, ive come accross this after doing a 'use text link as
    > submit' search...
    >
    > <a href="#" onclick="document['Table3FORM'].submit()">text
    > here</a>
    >
    > This appears to submit (the page refreshes), but im not
    > sure how to capture this.
    >
    > Ive been using the isset function to determine the name of
    > regular submit buttons but how would i add a name attribute
    > to the line of code above?
    >
    > Any assistance appreciated, J


    Just add "name='newname' " into the statement? Any object can be named, if
    I'm answering what you asked.

    HTH,

    Twayne`



  10. #10
    Twayne
    Guest

    Default Re: text box as submit button?

    In news:jofan.4dgwdn@no-mx.forums.netobjects.com,
    jofan <jofan.4dgwdn@no-mx.forums.netobjects.com> typed:
    > Even better...i think,
    >
    > I've used a css style to change the look of the standard
    > button (added a new background image), and this works fine.
    >
    > Is this a better way to do this?
    >
    > J


    A "better way" is too judgemental a thing; it all depends on you and what
    you want to do. I DO wish I'd thought to mention CSS, but didn't think of it
    because I think I judged your expertise level lower than it really is. IMO
    the more you can do with CSS the better along these lines! I wish it had
    occurred to me.

    As I said before, if y ou aren't getting the answers you need, then you
    should try asking the question again in more detail about precisely what
    you're doing. As far as I can see, after reconstructing the thread this
    morning, all you wanted to do was create 5 different Submit buttons and now
    I think you also mean each one should look different for whatever reason.
    If things are sorted for you now, that's great! It sounds like they are.

    HTH,

    Twayne`



Posting Permissions

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