PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sat Aug 18, 2018 5:41 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Mon Sep 12, 2016 8:35 am 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4420
Location: United Kingdom
I am giving the admin people a choice of using two options, via two radio buttons.
Below the radio buttons are two input fields. One for a Code, one for a URL.

They both use the SAME database field. On the consumer site, it will query if there is a / in the field and if there is, it will provide a URL link.
If there is no / in the field, it will create the URL based on the code.

But in Admin, I want the said field that is selected via the radio buttons, to be "lit", so they now which one they have chosen, will be used. I can do that on page loading, but how do I alter it if they alter the radio buttons. I Assume via some javascript, but not sure how to do it.

Syntax: [ Download ] [ Hide ]
Which link to use: <input type='radio' name='freetext' value='stockcode' checked>stockcode
<input type='radio' name='freetext' value='url'>URL <br/>
Stock Code: <input type='text' name='stockcode' style='width: 160px' value='JHG876'><br/>
Or enter URL: https://www.site.co.uk<input type='text' name='url' style='width: 160px' value='JHG876'>


It's just a means of making sure when they click it, they know full well which one will be used.
It can be lit, or a border added. Not bothered.

_________________
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.


Last edited by requinix on Mon Sep 12, 2016 8:56 am, edited 1 time in total.
syntax=php -> syntax=html


Top
 Profile  
 
PostPosted: Mon Sep 12, 2016 8:59 am 
Offline
Spammer :|
User avatar

Joined: Wed Oct 15, 2008 2:35 am
Posts: 6617
Location: WA, USA
Sounds like there were two different questions in there.

1. How to make it show in Admin? Store the user's choice.
2. How to do something if they pick a different option? Yeah, Javascript. But you'll have to decide how to show the difference. You could highlight or you could use a border or you could show/hide/enable/disable stuff. Pick one and do it.


Top
 Profile  
 
PostPosted: Mon Sep 12, 2016 9:02 am 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4420
Location: United Kingdom
In the end, none of them.
I've now decided it's easier to just have admin pop the code or URL in the box, and use a PHP query to see if it is a URL or not (via a query for the /).

But the plan was to click UrL radio button and the urL box would light up yellow.
Same for the stock code box.

_________________
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group