Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Bastard
Jul 13, 2001

We are each responsible for our own destiny.

The Wizard of Poz posted:

I wouldn't use it without at least checking a site's browser demographic beforehand. I haven't done a lot with flexbox - what did you find in Android, I'm interested?

First one is easy: all modern/most used browsers so IE10 and up, latest version of Chrome, FF, Safari, iOS and Android. The thing I encountered in Android was that while it worked on the iPhone and desktop, on the Android device (a Galaxy I think) it basically looked like somebody unsuccessfully played Jenga with the DOM structure :saddowns:. Everything was just all over the place.

But then again, that was late at night so I'll have a crack at it again sometime.

Adbot
ADBOT LOVES YOU

Hughmoris
Apr 21, 2007
Let's go to the abyss!
What is the recommended "build a webpage for dummies" software?

At my hospital, our physicians use what are essentially webpages (iForms) that are composed of radio buttons, checkboxes, freetext boxes etc... for entering orders on patients.

If I'm looking for ease of use in creating simple standalone webpages, what software would you recommend? I've heard of Dreamweaver but I can't say I know too much about it. I highly doubt my company will pay for a license either.

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

Would this be something that has to be completely internal (which it sounds since you said hospital), or could be hosted externally?

The problem with checkboxes/text/forms etc. is that it's easy to make static HTML pages so people can load that page. What gets harder is making a server component that 'records' all the input they've put in. And what happens to that input? Does it go to a database? An excel file? Are there HIPAA considerations?

kedo
Nov 27, 2007

Agreed. Unless all you want to do is mockup something with zero functionality, it sounds like what you're talking about is going to be super complicated if for no other reason than HIPAA. Even if you succeeded in building a simple form that can send data somewhere, storing that data as securely as HIPAA requires is going to be way, way past you. In this case, hire a developer.

If all you want to do is build a web page for any other purpose, Dreamweaver does indeed work well. There's also stuff like Macaw if you want to support awesome developers or Google Web Designer if you love Google.

If you have the gumption, you could also probably learn enough HTML to code a simple (albeit likely non-functional) form in an afternoon or two.

Hughmoris
Apr 21, 2007
Let's go to the abyss!

Scaramouche posted:

Would this be something that has to be completely internal (which it sounds since you said hospital), or could be hosted externally?

The problem with checkboxes/text/forms etc. is that it's easy to make static HTML pages so people can load that page. What gets harder is making a server component that 'records' all the input they've put in. And what happens to that input? Does it go to a database? An excel file? Are there HIPAA considerations?


kedo posted:

Agreed. Unless all you want to do is mockup something with zero functionality, it sounds like what you're talking about is going to be super complicated if for no other reason than HIPAA. Even if you succeeded in building a simple form that can send data somewhere, storing that data as securely as HIPAA requires is going to be way, way past you. In this case, hire a developer.

If all you want to do is build a web page for any other purpose, Dreamweaver does indeed work well. There's also stuff like Macaw if you want to support awesome developers or Google Web Designer if you love Google.

If you have the gumption, you could also probably learn enough HTML to code a simple (albeit likely non-functional) form in an afternoon or two.

For my purposes, I don't have to worry about HIPAA or security at that stage of the game. That is already being taken care of, and all of this takes place internally. The basics is the physician fires up the Order Entry program, makes a selection from a range of topics (ex: my patient just had a heartattack) and an interactive form launches. This form is written in HTML that has an accompanying VGR file that essentially tells the Order Entry program how to react to the HTML.

Creating these interactive forms is not in my job scope, I was just trying to learn an extra marketable skill. I know the bare basics of HTML but I was hoping there was some software out there that I could essentially drag & drop buttons, boxes etc.. These are basically single-use webpages.

I will check out Macaw, Dreamweaver and Google Web Designer.

pram
Jun 10, 2001
How do I stop long urls from breaking divs in Firefox? I have:

code:
word-wrap: break-word;
word-break: break-all;
-moz-hyphens: auto;
and it still breaks the gently caress out. Everything else is wraps except links. It works fine in Chrome, IE, Safari, but not Mozilla Firefox 32.0.3 'Lumpy Lynx'

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb

Hughmoris posted:

For my purposes, I don't have to worry about HIPAA or security at that stage of the game. That is already being taken care of, and all of this takes place internally.

I was hoping there was some software out there that I could essentially drag & drop buttons, boxes etc.

There's stuff like Google Forms but definitely not something you want to be putting patient data through.

Even if it's "already being taken care of" you can't just hand wave HIPAA stuff

Hughmoris
Apr 21, 2007
Let's go to the abyss!

fletcher posted:

There's stuff like Google Forms but definitely not something you want to be putting patient data through.

Even if it's "already being taken care of" you can't just hand wave HIPAA stuff

I'm well aware of HIPAA. I realize it probably appears I'm hand-waving the HIPAA because I'm not sure how to properly explain the specific interaction I'm discussing. For my question, assume I'm just asking for software that will allow a rookie to create a simple interactive webpage. Thanks for the google forms suggestion, I'll check it out.

obstipator
Nov 8, 2009

by FactsAreUseless

pram posted:

How do I stop long urls from breaking divs in Firefox? I have:

code:
word-wrap: break-word;
word-break: break-all;
-moz-hyphens: auto;
and it still breaks the gently caress out. Everything else is wraps except links. It works fine in Chrome, IE, Safari, but not Mozilla Firefox 32.0.3 'Lumpy Lynx'
This might do it:
white-space: pre-line;
white-space: -moz-pre-wrap;

Or this: http://compass-style.org/reference/compass/typography/text/force-wrap/#mixin-force-wrap

I cant remember but I think one of those makes tabs get all screwy.

pram
Jun 10, 2001
Yep pre-line did the trick. Thanks ;D

kedo
Nov 27, 2007

Now this is interesting:

https://www.google.com/webmasters/tools/mobile-friendly/

Supposedly they're going to start tagging search results as mobile friendly or not.

Kobayashi
Aug 13, 2004

by Nyc_Tattoo
I think they've been doing it for a while. Here's what it looks like in action:

https://www.google.com/search?site=...0.0.BAq2p9ye4Ww

Heskie
Aug 10, 2002

Bastard posted:

First one is easy: all modern/most used browsers so IE10 and up, latest version of Chrome, FF, Safari, iOS and Android. The thing I encountered in Android was that while it worked on the iPhone and desktop, on the Android device (a Galaxy I think) it basically looked like somebody unsuccessfully played Jenga with the DOM structure :saddowns:. Everything was just all over the place.

But then again, that was late at night so I'll have a crack at it again sometime.

I've been trying Flexbox on a recent project. Solved By Flexbox has some good information and the syntax (using Autoprefix) is nice to work with after years of floats and clearfix. That said, I've found myself going back to floats/inline-blocks more than I'd expect. I went into the project thinking that it would solve all my layout problems but in reality that's not the case. Its another tool to add your toolkit rather than being a silver bullet to CSS layout.

Speaking of layouts - I got back into using Susy and while I really like it my Sass compilation (gulp-ruby-sass) times are up to 6-8 seconds and increasing. I use BrowserSync on several devices and its very frustrating waiting for the Sass to compile every little change. I temporarily removed Susy and they went down to about 1.5-2s.

I looked into Libsass (gulp-sass) but it doesn't have Sass 3.3 features which Susy and a number of other Sass extensions (Neat, Breakpoint etc) require. For reference the compilation time is about 80ms on Libsass without Susy. For now I've dropped Ruby Sass, Susy and Breakpoint and I'm trying Libsass with sass-mq (pre Sass 3.3 version).

I like Susy though and would prefer to keep using it but with lower compilation times. Are these the sort of Sass compilation times the norm?

putin is a cunt
Apr 5, 2007

BOY DO I SURE ENJOY TRASH. THERE'S NOTHING MORE I LOVE THAN TO SIT DOWN IN FRONT OF THE BIG SCREEN AND EAT A BIIIIG STEAMY BOWL OF SHIT. WARNER BROS CAN COME OVER TO MY HOUSE AND ASSFUCK MY MOM WHILE I WATCH AND I WOULD CERTIFY IT FRESH, NO QUESTION
I have a requirement for a project I'm working on that I'm having a little bit of trouble wrapping my head around.

The project is using Bootstrap and we want to be able to create customisations for the users fairly simply. The customisation is as simple as changing the colours, so I figured I would download the LESS for Bootstrap, override the colours specified in variables.less and hey presto - custom coloured Bootstrap CSS. The problem is, I want to separate out these colour definitions from the rest of the styling, in the processed CSS. This is so that when we roll out an update, we don't override their custom CSS with our newly updated default CSS.

At the moment, I'm picturing the CSS loading on the page like this:

1. "default.css" - contains all of the default styling. This will be a single CSS file that has been process with all of Bootstrap and our project-specific CSS styling in it.

2. "theme/<themename>/custom.css" - contains their company specific styles, so basically a list of colour overrides.

So I just need some way to actually generate that custom.css file. I basically want one '.less' file that declares the colour variables and another '.less' file that contains every colour related rule and overrides each with the associated variables. And then those two '.less' files will compile into a single 'custom.css' file that we can supply to the company.

The long way to do this would be to look at the compiled default.css, do a search for every instance of the default colour, and copy out those rules into a new file as overrides. What I'm wondering is, is there a quicker way?

putin is a cunt fucked around with this message at 00:28 on Nov 27, 2014

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

I've only done 'vanilla' bootstrap, this might help:
http://stackoverflow.com/questions/10451317/twitter-bootstrap-customization-best-practices

putin is a cunt
Apr 5, 2007

BOY DO I SURE ENJOY TRASH. THERE'S NOTHING MORE I LOVE THAN TO SIT DOWN IN FRONT OF THE BIG SCREEN AND EAT A BIIIIG STEAMY BOWL OF SHIT. WARNER BROS CAN COME OVER TO MY HOUSE AND ASSFUCK MY MOM WHILE I WATCH AND I WOULD CERTIFY IT FRESH, NO QUESTION

Thanks for that, but I think we're talking about two different things. The people on that SO question are talking about how to organise things so that they can keep their LESS files separate - this isn't a problem for me, I've got that part sorted. What I want is two separate CSS files to be output by the LESS processor. One with all the default style declarations, and a second one with just colour declarations. To do this I'm going to need to somehow come up with a LESS file that contains ONLY colour declarations - I was wondering if there's an easy way to do this or is it going to be a long manual process?

Heskie
Aug 10, 2002

The Wizard of Poz posted:

Thanks for that, but I think we're talking about two different things. The people on that SO question are talking about how to organise things so that they can keep their LESS files separate - this isn't a problem for me, I've got that part sorted. What I want is two separate CSS files to be output by the LESS processor. One with all the default style declarations, and a second one with just colour declarations. To do this I'm going to need to somehow come up with a LESS file that contains ONLY colour declarations - I was wondering if there's an easy way to do this or is it going to be a long manual process?

I don't think LESS has an equivalent of Sass' !default but could you @import the Bootstrap variables, then @import the custom LESS file (overriding previously set Bootstrap colours etc) and finally import the rest of Bootstrap.

Is the problem that the users wont/can't/don't use LESS so they need a vanilla CSS file to work with? Otherwise that SO answer should work if I'm understanding correctly?

I've never actually used Bootstrap for a project though so I might be well off the mark!

putin is a cunt
Apr 5, 2007

BOY DO I SURE ENJOY TRASH. THERE'S NOTHING MORE I LOVE THAN TO SIT DOWN IN FRONT OF THE BIG SCREEN AND EAT A BIIIIG STEAMY BOWL OF SHIT. WARNER BROS CAN COME OVER TO MY HOUSE AND ASSFUCK MY MOM WHILE I WATCH AND I WOULD CERTIFY IT FRESH, NO QUESTION

Heskie posted:

Is the problem that the users wont/can't/don't use LESS so they need a vanilla CSS file to work with?

Close, but more specifically we don't intend for them to work with it at all. They will request the branding from us, at which point I will open a mythical LESS file that contains all of the colour variables, set the colours I need, process the LESS into a single CSS file that contains ONLY colour rule overrides, and send that file to them with instructions to place it into a subdirectory of a special themes folder, and then they can set the theme from within the application and it will load the CSS from that location.

The point of this is so that a few months down the track, if we update the project and that update contains some changes to the default CSS, they can install the update without it overwriting their custom colours.

Edit: for clarification, I think I've confused things a little by mentioning Bootstrap. Pretend like Bootstrap isn't involved at all, and just think of it as "some site with a bunch of CSS where colour rules are sprinkled throughout". I need to take those colour rules, bring them out into a separate CSS override file that can then be optionally included on the site to override the default colours.

putin is a cunt fucked around with this message at 01:50 on Nov 27, 2014

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.
I've been transitioning to less lately due to their more declarative approach, a syntax that works for me. LESS doesn't have !default because variables are lazy. All you need to do is assign the variable later than previous assignments and the value across the file will be that last assignment.

So all you need to do is include a file of overrides at the appropriate (probably root) scope after everything else.

putin is a cunt
Apr 5, 2007

BOY DO I SURE ENJOY TRASH. THERE'S NOTHING MORE I LOVE THAN TO SIT DOWN IN FRONT OF THE BIG SCREEN AND EAT A BIIIIG STEAMY BOWL OF SHIT. WARNER BROS CAN COME OVER TO MY HOUSE AND ASSFUCK MY MOM WHILE I WATCH AND I WOULD CERTIFY IT FRESH, NO QUESTION
Somehow I'm failing to explain this correctly. I have no trouble setting variables and so forth in LESS. The problem is that ALL of the LESS for Bootstrap (and my site for that matter) is jumbled together. There's no single LESS file that is used to generate all of the colour rules in the resulting CSS. I need to be able to generate a CSS (not LESS) file that contains only the colour rules. I'm talking about providing two CSS files (not LESS files) to the customer. One will be the complete site CSS. The other will be CSS overrides for just the colour declarations. If this was my own CSS then I might be able to do this fairly easily, but because I have Bootstrap involved I don't know all of the CSS rules that I would need to override in order to replace the default Bootstrap colours everywhere that they appear.

Edit: The problem with your proposed solution is that it will still generate just one CSS file. This means if we update the application and redistribute it, they will lose their custom colours because their custom CSS file will be replaced with the standard CSS file. I need them to have two files - one that is the standard CSS file and can be replaced without issue whenever we roll out a new version. The other is just colour declarations in a separate custom CSS file, this CSS file will not be included in any updates and will thus allow them to preserve their custom colours through an update. Bear in mind that the customer will ONLY have CSS files, they will not have any LESS files.

putin is a cunt fucked around with this message at 03:29 on Nov 27, 2014

Kobayashi
Aug 13, 2004

by Nyc_Tattoo
Is there any way you could give your customers two LESS files and use LESS.js to compile the CSS in browser?

down with slavery
Dec 23, 2013
STOP QUOTING MY POSTS SO PEOPLE THAT AREN'T IDIOTS DON'T HAVE TO READ MY FUCKING TERRIBLE OPINIONS THANKS

The Wizard of Poz posted:

Somehow I'm failing to explain this correctly. I have no trouble setting variables and so forth in LESS. The problem is that ALL of the LESS for Bootstrap (and my site for that matter) is jumbled together. There's no single LESS file that is used to generate all of the colour rules in the resulting CSS. I need to be able to generate a CSS (not LESS) file that contains only the colour rules. I'm talking about providing two CSS files (not LESS files) to the customer. One will be the complete site CSS. The other will be CSS overrides for just the colour declarations. If this was my own CSS then I might be able to do this fairly easily, but because I have Bootstrap involved I don't know all of the CSS rules that I would need to override in order to replace the default Bootstrap colours everywhere that they appear.

Edit: The problem with your proposed solution is that it will still generate just one CSS file. This means if we update the application and redistribute it, they will lose their custom colours because their custom CSS file will be replaced with the standard CSS file. I need them to have two files - one that is the standard CSS file and can be replaced without issue whenever we roll out a new version. The other is just colour declarations in a separate custom CSS file, this CSS file will not be included in any updates and will thus allow them to preserve their custom colours through an update. Bear in mind that the customer will ONLY have CSS files, they will not have any LESS files.

Why don't you just use plain CSS for bootstrap?

putin is a cunt
Apr 5, 2007

BOY DO I SURE ENJOY TRASH. THERE'S NOTHING MORE I LOVE THAN TO SIT DOWN IN FRONT OF THE BIG SCREEN AND EAT A BIIIIG STEAMY BOWL OF SHIT. WARNER BROS CAN COME OVER TO MY HOUSE AND ASSFUCK MY MOM WHILE I WATCH AND I WOULD CERTIFY IT FRESH, NO QUESTION

Kobayashi posted:

Is there any way you could give your customers two LESS files and use LESS.js to compile the CSS in browser?

That seems like a bad idea, performance-wise. Unless there's something I'm misunderstanding?


down with slavery posted:

Why don't you just use plain CSS for bootstrap?

Because the default stylesheet involves changes to Bootstrap's colours, so I need the variables.less file.

down with slavery
Dec 23, 2013
STOP QUOTING MY POSTS SO PEOPLE THAT AREN'T IDIOTS DON'T HAVE TO READ MY FUCKING TERRIBLE OPINIONS THANKS

The Wizard of Poz posted:

Because the default stylesheet involves changes to Bootstrap's colours, so I need the variables.less file.

? just redefine them in your less file?

i dont really use bootstrap because of the heaps of worthless css you get with it, but is it not possible?

putin is a cunt
Apr 5, 2007

BOY DO I SURE ENJOY TRASH. THERE'S NOTHING MORE I LOVE THAN TO SIT DOWN IN FRONT OF THE BIG SCREEN AND EAT A BIIIIG STEAMY BOWL OF SHIT. WARNER BROS CAN COME OVER TO MY HOUSE AND ASSFUCK MY MOM WHILE I WATCH AND I WOULD CERTIFY IT FRESH, NO QUESTION

down with slavery posted:

? just redefine them in your less file?

i dont really use bootstrap because of the heaps of worthless css you get with it, but is it not possible?

How do you expect that to work if the Bootstrap LESS is already compiled into CSS? It's not going to care about my LESS variables...

down with slavery
Dec 23, 2013
STOP QUOTING MY POSTS SO PEOPLE THAT AREN'T IDIOTS DON'T HAVE TO READ MY FUCKING TERRIBLE OPINIONS THANKS

The Wizard of Poz posted:

How do you expect that to work if the Bootstrap LESS is already compiled into CSS? It's not going to care about my LESS variables...

You use your LESS file to override the places compiled bootstrap css is using colors? Are you really using so many features of bootstrap that you can't go through and just make a less file to overwrite the colors you want?

Sedro
Dec 31, 2008
1. Compile your LESS with modifications
2. Compare the compiled CSS to the original bootstrap CSS to generate a CSS patch file
3. Serve up the original bootstrap CSS and your patch

step 2 left as an exercise for the reader

putin is a cunt
Apr 5, 2007

BOY DO I SURE ENJOY TRASH. THERE'S NOTHING MORE I LOVE THAN TO SIT DOWN IN FRONT OF THE BIG SCREEN AND EAT A BIIIIG STEAMY BOWL OF SHIT. WARNER BROS CAN COME OVER TO MY HOUSE AND ASSFUCK MY MOM WHILE I WATCH AND I WOULD CERTIFY IT FRESH, NO QUESTION

Sedro posted:

1. Compile your LESS with modifications
2. Compare the compiled CSS to the original bootstrap CSS to generate a CSS patch file
3. Serve up the original bootstrap CSS and your patch

step 2 left as an exercise for the reader

Thank you, this is exactly the solution I'm after. It's step 2 that I'm asking for advice on.

down with slavery posted:

You use your LESS file to override the places compiled bootstrap css is using colors? Are you really using so many features of bootstrap that you can't go through and just make a less file to overwrite the colors you want?

It's more about having a consistent and repeatable way to do it that isn't so prone to human error, that's all.

putin is a cunt fucked around with this message at 06:12 on Nov 27, 2014

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

The Wizard of Poz posted:

Thank you, this is exactly the solution I'm after. It's step 2 that I'm asking for advice on.


It's more about having a consistent and repeatable way to do it that isn't so prone to human error, that's all.


Step 2:

diff bootstrap.css myVersion.css > whatIsDifferent.txt

Look through the text file and make a new CSS file based on what you see. Serve it after the bootstrap CSS on your site.

Kings Of Calabria
Sep 10, 2013
Does anyone have a recommendation for user management software? I was using userfrosting for a project but it's turning into a garbled mess over time, and I'd rather have a "cloud based" database of users that I can access, and read/write custom variables into. This is a "starter" project that will be passed off to an agency with more in-house capability for DB admin and things like that, so I'd like to save time and get more into the meat of the concept instead of dicking around with MySQL for now. Prefer PHP. I've done the quickstart with UserApp.io and checked out Stormpath seems ok too. Just wanted to know if anyone had other recommendations or suggestions.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Rant follows.

So I'm wanting to use Facebook's Flux and React on a project. I'm part way in to it and using RequireJS.

I haven't used Flux before, so I'm learning as I go.

I go to download their Dispatcher.js file. Oops, Facebook uses Browserify and the ES6 class statement. I dig around for a bit and realize I've got to clone the repo and do an npm install to build a de-sugarified version. Good to go now...

Oh wait, it also depends on invariant.js. Ok, I'll just add that to my RequireJS-style require statement.

Oh no, won't work, Dispatcher.js and invariant.js both use CommonJS-style require and module.exports. I've got to wrap them with RequireJS's code for handling CommonJS modules.

I loving hate javascript tooling and modules and bleh. The people who came up with this house of cards should be ashamed.

I could have switched everything over to using browserify, but man this is just a constant on-going pain. I don't really want to use browserify anyway, as this is a complex single page app and there's like 2MB of js that I don't want to load all at once. I'm not sure if it's one of those things where it's irritating because I don't do it enough and I'd think the same thing about...say...python's import statement, if I wasn't really familiar with python.

Skiant
Mar 10, 2013

Thermopyle posted:

Rant follows.

So I'm wanting to use Facebook's Flux and React on a project. I'm part way in to it and using RequireJS.

I haven't used Flux before, so I'm learning as I go.

I go to download their Dispatcher.js file. Oops, Facebook uses Browserify and the ES6 class statement. I dig around for a bit and realize I've got to clone the repo and do an npm install to build a de-sugarified version. Good to go now...

Oh wait, it also depends on invariant.js. Ok, I'll just add that to my RequireJS-style require statement.

Oh no, won't work, Dispatcher.js and invariant.js both use CommonJS-style require and module.exports. I've got to wrap them with RequireJS's code for handling CommonJS modules.

I loving hate javascript tooling and modules and bleh. The people who came up with this house of cards should be ashamed.

I could have switched everything over to using browserify, but man this is just a constant on-going pain. I don't really want to use browserify anyway, as this is a complex single page app and there's like 2MB of js that I don't want to load all at once. I'm not sure if it's one of those things where it's irritating because I don't do it enough and I'd think the same thing about...say...python's import statement, if I wasn't really familiar with python.


Well hopefully the ES6 modules syntax should clear that clusterfuck and get rid of all that RequireJS or CommonJS or Browserify or whatever, because god drat all those tools are a loving pain to use. Even working with Angular and only its own Dependency Injection system is a hassle.

I'm not especially holding my breath right now, tho.

pipes!
Jul 10, 2001
Nap Ghost
Happy Blue Beanie Day, y'all :corsair:

The Dave
Sep 9, 2003

As much as I appreciate it I can't celebrate anything that glorifies Zeldman's face.

enthe0s
Oct 24, 2010

In another few hours, the sun will rise!
Does anyone here use Light Table as their primary editor and would like to give a comparison to Sublime Text? I'm thinking about switching over.

thegasman2000
Feb 12, 2005
Update my TFLC log? BOLLOCKS!
/
:backtowork:
So I am starting to delve into server-side code for the first time. I have a project I am using to learn linking html, php and mysql. The idea is simple, you search the database for a phone number. If its not in there you can add it. If it is in there it displays it and any notes people have left regarding it.

Now it works... kinda. I have a test wordpress site here and its hacky but workable.
http://moneyspiderdesign.com/FTWwp/search-for-a-number/

My question is regarding the form redirect to the php. I dont want it to "exit" the wordpress ecosystem. I want it to post the results of the search on the same page. Now my google fu is poor but someone on stack overflow suggested AJAX? Am I making this harder than it needs to be?

My Rhythmic Crotch
Jan 13, 2011

Ajax is the right way to go, yes. Just google for "php ajax server" and you will get tons of examples. Most people prefer to use the ajax function that comes with jQuery, but it's not mandatory. See here, the third chunk down (Request) to make an ajax call in jQuery and plain old javascript.

thegasman2000
Feb 12, 2005
Update my TFLC log? BOLLOCKS!
/
:backtowork:
So I have this code on the page
code:
<form action="http://moneyspiderdesign.com/FTWwp/search.php" method="POST">
<p><input name="number" type="text" /></p>
<p><input type="submit" value="Search" /></p>
</form>


and this code on the php file.

code:
<?php

// server details
$servername = "localhost";
$username = "dlfvyzmg_ftwUser";
$password = "thegasman2000";
$dbname = "dlfvyzmg_ftwTest";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
     die("Connection failed: " . $conn->connect_error);
} 

$sql = "SELECT Number, Note, Date FROM FTWList";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
     // output data of each row
     while($row = $result->fetch_assoc()) {
         echo "<br> Number: ". $row["Number"]. "<br> Notes: ". $row["Note"];
     }
} else {
     echo "0 results";
}

$conn->close();
?>  
So if i am getting this right I add the code from the third block on that link into the html, with the function() holding the php files code?

My Rhythmic Crotch
Jan 13, 2011

You need to get rid of the form submit. You're going to have to write some javascript, not just HTML. You'll attach the ajax call to the button click event.

Edit, something like this. Your HTML:
code:
<input type="text" id="inputbox">
<button onclick="DoThing()">Do the thing</button>
Your Ajax call. This is using jQuery so you will need to import that if you want to make this work.
code:
function DoThing() {
	mydata = $("#inputbox").val();
	$.ajax({
		url: someurl.php,
		type: 'post',
		data: mydata,
		statusCode: {
			200: function(result) {
				console.log("Success: " + result);
			},
			500: function(result) {
				console.log("Server error: " + result);
			}
		}
	});
}

My Rhythmic Crotch fucked around with this message at 01:40 on Dec 1, 2014

Adbot
ADBOT LOVES YOU

socialsecurity
Aug 30, 2003

So I've been out of the web design game for a while but my msp want's me to start working on some light sites. I used to work in Joomla a bunch it seems that it is not as popular as it was like 5 years ago, I've been reading good things about Drupal should I head in that direction or there an easier/better CMS out there.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply