Jump to content

Klyx99

New Members
  • Content count

    9
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Klyx99

  • Rank
    Newbie
  1. Klyx99

    Form Validation not working

    Hi I do have a backend for this, however I was attempting to migrate a lot of the little stuff before it went there - on aspect was just getting rid of the unwanted characters before it is sent. the line document.signup.char_name.focus(); is (i thought) more cosmetic - as I wanted the cursor back on the input where the error occurred. Not good? The onchange I mixed up with VB, VBA and other languages I do, where it changes per character typed, so I used onblurr as it (i thought ) triggered when focus was lost. However, with all that said and the appropiate changes, this seemed to work as expected - TYVM!! cheers!
  2. I cannot get this to fail when entering a non valid character cannot get the following to work (I use FFox). I did search around, and found most of this code on various search results - I am not fluent in JS (yet thus why I am slowly implementing into some of my projects). function checkInput() { var user_input = document.getElementById('char_name').value; var notgood = "!\"·$%&/()=?¿@#¬"; if ( notgood.test( user_input ) ) { document.getElementById('submitlink').removeAttribute('disabled'); }else{ document.getElementById('submitlink').setAttribute('disabled','disabled'); document.getElementById('badInput').innerHTML = 'Bad Input'; document.signup.char_name.focus(); Alert('Cannot use that character'); } } the line it is targeting: <input type="text" name="char_name" value="" id="char_name" required="" onblur="checkInput();"/> Working with pure javascript not jquery. ignore the disabled/not disabled The issue I am having, is when testing, it will not alert on bad character. it accepts the input. I tested this by inserting an alert in both conditions, it only acknowledges the accepted and moves on - even if I put one of those characters in there. Also, how can I check versus an empty space to add to that list?
  3. Klyx99

    Datagrid suggestion

    ok working now.. looks like pretty much what I was looking for. I'll skim over it and use it as a model. need some changes (unit price needs to be dynamic instead of static but the rest looks about right) thank you very much
  4. Klyx99

    Datagrid suggestion

    hi, not sure - page will not load
  5. Klyx99

    Datagrid suggestion

    I thought it would be more useful to move my biz app to the web, so I can work on it on the go. Everything went well! The only section I am stuck on is a page where I need to put in products and services. qty, desc, cost, total, then sub totals (labor,tax etc.) I've searched the net for some ideas, and most were overkill, others were too confusing. it is just one page I need. currently I just set up a table with JS but that seems to be more work than needed. Needs to adjust on the fly, ergo why I am using JS with the table. But my code seems to be more complex than needed, as it seems I am looking for a spreadsheet style. if i put "1" qty column I want the total to reflect it with the cost, and the totals as well. but the way I am going at it, is horrible (mostly because It needs to be JS, and I am not that fluent in it) anyone run across this, and how I might implement something of this nature - doesn't even have to be a table. I only enter at most 2 - 5 items at any given time. Do not want to use jquery if I do not need to. The page I currently have is a huge mess as I have been working on it forever LOL. Just cant get it to work. don't need code, just shoot me with some ideas, I'll scratch my head from there.
  6. Klyx99

    Recap on Assoc MultiDim. Arrays

    Im an old goat that is too stubborn to move to OOP (I will eventually - but grew up in the days of single letter vars and spaghetti code written in 1K to 16K of RAM - TIMEX SINCLAIR? COCO I,II,III ?? ANYONE??). Out of necessity of php/mysql I have had to become quite adept at separating logic code from presentation code - even procedural - since exe programing is completely different. If one takes their time and look at the big picture, it is quite simple to do w/o the need to move to OOP. to shed a little light on the code - there is a training mode and a RNG mob encounter mode(players just grinding) - this is determined else where and once they are set - it is turned into mob[] var. The mob var goes to the attack method until the battle is won, then it splits accordingly to who won (training mob won - level up, training mob lost - put your head down and leave LOL) and if it is a mob, either player is dead or gain xp and some gold :-) then it too branches back to their separate entities. there is a updateplayer() module that adjust anything that changes via a loop (foreach player as field=>data) while I thought it would be a very simple text rpg, it is becoming quite the beast :-) what I was hoping to do as mentioned above, was simplify the assignment of array vars, and moving this data back and forth. I only chose session vars because constant reading of db would be a waste - even if it is a small player base, and reading/writing ini files or xml files I fear, would have the same cumbersome results - unless (why I am here asking the pro's) there is a more efficent ways of handling player info. I did read your example of A to B, however, after certain sequences are done (finished battle for instance) that session is unset. (unset($_SESSION['mob']) until it is needed to be called again. That prevents (hopefully) your scenario mentioned. the only live session var at all times is player. (which can be destroyed on AFK too long). Thanks for the input, seems I am on the right track.. I'll keep an eye out for anyone else that has some more ideas.
  7. Im playing with some old gaming code and looking to clean it up. Every year I learn something new that helps. Right now only interested in learning beter way to handle assoc arrays and assigning them a little more efficient The following is scattered throughout the code - and seems very klunky if not messy. It works fine, but I don't like how it looks. what can I do to clean this up a smidgen: $mob = $_SESSION['mob']; $_SESSION['player']['level']++; $_SESSION['player']['hpmax'] += $mob['hp_buff']; $_SESSION['player']['strmax'] += $mob['str_buff']; $_SESSION['player']['defmax'] += $mob['def_buff']; $_SESSION['player']['strength'] = $_SESSION['player']['strmax']; $_SESSION['player']['hp'] = $_SESSION['player']['hpmax']; $_SESSION['player']['def'] = $_SESSION['player']['defmax']; $_SESSION['round'] = $round; $_SESSION['player']['seen_master'] = 1; updatePlayer(); What is the best way to clean this up. I really haven't found many tuts on something like this. I know I may end up finding away to pass the player around but this seems the best way. I am not dealing with OOP, (for the time being - still learning about that) so please keep any tips to procedural. The above player "sheet" has 50+ fields. I have done things like $p = $_SESSION['player'] ... do something.... then back to $_SESSION['player'] = $p For the curious, I have always used games to learn a language, as I feel a game seems to encompass many facets of any given language. So a couple questions when assigning values to a field, can you do calculations? 'hp' => += $mob['hp'] is there a more efficient way of assigning the above instead of doing a repetitive - I really love the DRY method whenever I can do it. is there something better than session var for passing a player around the website? I do use a custom MVC I created - procedural, not OOP (did not see one out there that was very good - so wrote one myself - no arrays, as is shown by many who try it), If anyone is interested in what a procedural one looks like, i'd be happy to show it. many I have found are really over done, this one is very simple (sorry digressed).
  8. Klyx99

    Stopping Program Execution Conundrum

    hmmm I seem to have difficulty conveying my dilemma. writing a webpage vs pascal/c++/vb etc.. is (obviously) different. without using apps like smarty, if i have a page drawn up. and I want to implement login, get customer, edit customer, add customer, all these are different methods yes, but was unable to convey what I was looking for. as shown by people reading it multiple times LOL my small biz app is now turning into spaghetti, and for as small as it is, it should not. I'll work with this and see what I can come up with. The prob is that I have a decent css layout that looks good, so do not want to mess that up. or do redundant repetitive coding. but at the same time, do not want to incorporate a large frameworks - as that too is unnecessary for the size of my project. does that make better sense?
  9. I write lots of personal apps. And love writing in PHP/MySQL I decided to make a php app for my biz. Small so didnt think I needed anything fancy. unlike writing apps, php scripts will continue until the page is done (even on a header(location...). I use router pages with includes, and using $_GET as the switch, but that seems to be getting cluttered and not very good. I am currently looking into CakePHP and that is amazing, but trust me when I say, that will be a massive over kill for what I want. in shor, psuedo code below if not logged in, login else check for afk (session var) now with that first line, it can be problematic. because of the following if no customer, search customer, display results(once customer is found, stick in session var) but login is still showing - but if i do the if/then/else it works, however the following will show and now it turns into spaghetti with customer, do something switch ($_GET[somevar])){ option 1: include(this page) option 2: include(thatpage) option 3: include( and the other page) } as you can see, that will turn into a train wreck. for my small web pages - that works fine. now if i switch and have the scrip make new pages, then I break my css layouts. I know some of you ar thinking, what about smarty, that too seems a little more that I want to get into, especially since php works fine I looked at OSS php POS and they are not what I want. it is simple, login, get a customer, store info about them, edit them with work they need done, finalize the ticket. thats it. any suggestions would be great, not looking for a heavy duty app, I am sure I am missing something simple with just php/mysql and I am over looking it. thanks!
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.