Guest Posted May 13, 2019 Share Posted May 13, 2019 I'm trying to put together something to use a Best Offer option in my website. Yes, I'm riffing on what eBay is doing with their listings. So far, I've got the offer button at the bottom of the product_info pages. Like this in my test site: When you click that button for Make An Offer, you get a popup which overlays the product_info screen you're on: I've got the Best Offer Price field populated from the start with the $ symbol, but when you type in your dollar amount...and change your mind and back over the whole field...the dollar sign disappears. Is there a way to make that stick? Like mud? It never goes away? You can only back over and change the price you originally entered, but...the $ sign never goes away? The code I'm using for that field looks like this: <?php echo tep_draw_input_field('enquiry', '$', 0, 1, NULL, 'required aria-required="true" maxlength="6" id="inputEnquiry" placeholder="' . ENTRY_OFFER_TEXT . '"'); echo FORM_REQUIRED_INPUT; ?> shipping not included </div> What I'm doing is kind of a mash-up of the Contact Us form. And all credit in the world goes to @JcMagpie for getting me rolling. I just can't figure out how to make that dollar sign stick. Is that possible? I don't know how. And he's asleep, otherwise I'd be driving him crazy. Any help is appreciated! - Andrea Link to comment Share on other sites More sharing options...
♥raiwa Posted May 13, 2019 Share Posted May 13, 2019 This could be achieved with javascript. But it's much easier to just show the $ sign permanent outside before the inputfield. <?php echo '$ ' . tep_draw_input_field('enquiry', '', 0, 1, NULL, 'required aria-required="true" maxlength="6" id="inputEnquiry" placeholder="' . ENTRY_OFFER_TEXT . '"'); echo FORM_REQUIRED_INPUT; ?> shipping not included </div> About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
♥JcMagpie Posted May 13, 2019 Share Posted May 13, 2019 You should find that the place holder will only disappear when you type in that filed. If you then erase what you type and press enter it will reappear, that is how it works. Link to comment Share on other sites More sharing options...
♥Tsimi Posted May 14, 2019 Share Posted May 14, 2019 You could use input group as alternative solution. This is an example code from the bootstrap site. Adjust that to match what you need. <div class="input-group"> <span class="input-group-addon" id="basic-addon1">@</span> <input type="text" class="form-control" placeholder="Username" aria-describedby="basic-addon1"> </div> Link to comment Share on other sites More sharing options...
MrPhil Posted May 14, 2019 Share Posted May 14, 2019 If "parking" the currency sign just outside (before) the field isn't desirable, it might be possible to do it in Javascript. At each keystroke within the field, you'd check the string value, and if it's missing the currency sign in the right place, force it to be added to the string. This ought to work too for currencies that are after the amount. Is it critical that the currency sign be in the text field itself, or can it be added on later (in the PHP code processing the form input), if missing? Link to comment Share on other sites More sharing options...
Guest Posted May 14, 2019 Share Posted May 14, 2019 25 minutes ago, MrPhil said: Is it critical that the currency sign be in the text field itself, or can it be added on later (in the PHP code processing the form input), if missing? Not at all. This is just me getting tedious about minor cosmetic things. And learning how to manipulate code. That's the fun part! I'm going to play around with the suggestions I've received and see what makes me happiest. Thanks everybody! - Andrea Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.