Greenguy's Board


Go Back   Greenguy's Board > Programming & Scripting
Register FAQ Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 2010-02-10, 11:44 AM   #1
LD
wtfwjd?
 
LD's Avatar
 
Join Date: May 2007
Posts: 2,103
Making a field required in DragonList

My coding skills are very minimal, but I was thinking there might be some way, perhaps in mysql admin, to make one of the user input fields required. It's a pretty common script around here, so maybe someone has alreadt figured it out...
__________________
Artisteer Wordpress Theme Generator Create Custom Themes!
My Little Network
LD is offline   Reply With Quote
Old 2010-02-12, 10:04 PM   #2
HarryM
No offence Apu, but when they were handing out religions you must have been out taking a whizz
 
HarryM's Avatar
 
Join Date: Jan 2004
Location: Australia
Posts: 285
Send a message via ICQ to HarryM
Got a URI to the input form? Since it's someone else's script client side would be the way, but if their code is not obfuscated post it here and I'll fix it.
__________________
Click here to make huge $$$
HarryM is offline   Reply With Quote
Old 2010-02-14, 07:24 AM   #3
LD
wtfwjd?
 
LD's Avatar
 
Join Date: May 2007
Posts: 2,103
Here's the form.

http://www.lusciousdelights.com/link...ers/submit.php

I was hoping to require user to put something in one of the three fields "movies, pics, or other" so it would not be blank. But on second thought, maybe it's not such a good idea since I accept blogs.

I think this is the code for the input:

Code:
// Get the site elements
// Make the elements field back into a usable array
$elements = explode_assoc("=",",",$site->elements);
$result = DoQuery("select eid as id, element_name as name from dl_elements");
while($element = mysql_fetch_object($result)) {
	$i = (int)$element->id;
	print ("<tr>\n".
		"<td class='llthead' align='right'>\nNo.&nbsp;of&nbsp;" . $element->name . ":\n</td>\n".
		"<td class='lltbody'>\n<input type='text' size='5' name='elements[$i]' value='" . $elements["$i"] . "' />\n</td>\n".
		"</tr>\n");
}		
print("<tr>\n".
	"<td class='llthead' align='right'>\nSite Type:\n</td>\n".
	"<td>\n<select name='type'>\n");
__________________
Artisteer Wordpress Theme Generator Create Custom Themes!
My Little Network
LD is offline   Reply With Quote
Old 2010-02-14, 12:59 PM   #4
Maj. Stress
Progress rarely comes in buckets, it normally comes in teaspoons
 
Maj. Stress's Avatar
 
Join Date: Jun 2005
Location: Dark Side Of Naboo
Posts: 1,289
LD you could add a site type "blogs" and put the include on the free site pages. I use flv's on my blogs so I just submit them as having 10 vids since I have 10 posts per page.
Maj. Stress is offline   Reply With Quote
Old 2010-02-15, 09:46 PM   #5
HarryM
No offence Apu, but when they were handing out religions you must have been out taking a whizz
 
HarryM's Avatar
 
Join Date: Jan 2004
Location: Australia
Posts: 285
Send a message via ICQ to HarryM
That PHP code you posted is just priting the submit form, you can't validate input at this stage.

This would work though (on client side), I commented it so you can change it to suit.

Code:
<script type="text/javascript" >
    function validate() 
    {
        // Get submission form
        var submitForm = document.forms["submission_form"];
        
        // Number of input fields entered by user
        var count = 0;
        
        // Check the 3 elements for valid content
        for (var i = 1; i < 4; i++)
        {
            if (validateContentCount(submitForm.elements["elements[" + i + "]"])) 
            {
                count++;
            }
        }

        // Make sure one text area was entered by user
        if (count < 1) 
        {
            var errorMessage = document.createElement("p");
            var errorText = document.createTextNode("Error: Must specify content count.");
            errorMessage.appendChild(errorText);
            errorMessage.style.color = "#ff0000";
            submitForm.appendChild(errorMessage);
            return false;
        }
        else 
        {
            return true;
        }
    }

    function validateContentCount(element) 
    {
        // Check for at least one digit (\d)
        var intCheck = new RegExp(/\d+/);

        if (!intCheck.test(element.value)) 
        {
            return false;
        }
        else 
        {
            return true;
        }
    }
</script>
__________________
Click here to make huge $$$
HarryM is offline   Reply With Quote
Old 2010-02-15, 09:49 PM   #6
HarryM
No offence Apu, but when they were handing out religions you must have been out taking a whizz
 
HarryM's Avatar
 
Join Date: Jan 2004
Location: Australia
Posts: 285
Send a message via ICQ to HarryM
Change your submit form's html to this BTW:

Code:
<form name='submission_form' method='post' action='/linklist/users/submit.php' onsubmit="return validate()" >
__________________
Click here to make huge $$$
HarryM is offline   Reply With Quote
Old 2010-02-16, 09:19 AM   #7
LD
wtfwjd?
 
LD's Avatar
 
Join Date: May 2007
Posts: 2,103
Thanks, I'll give it a shot. I know enough code to be dangerous, but that looks like it should work.
__________________
Artisteer Wordpress Theme Generator Create Custom Themes!
My Little Network
LD is offline   Reply With Quote
Old 2010-02-20, 12:59 AM   #8
acluett89
Internet! Is that thing still around?
 
acluett89's Avatar
 
Join Date: Feb 2010
Posts: 2
The package you need to install is most likely called "php-mysql" You will also need "MySQL-client" In any case, "yum search php mysql" should get you the relevant packages.
__________________
Ontario Mortgage Broker
acluett89 is offline   Reply With Quote
Old 2010-02-26, 12:38 PM   #9
DIVAD3
I'm going to the backseat of my car with the woman I love, and I won't be back for TEN MINUTES
 
DIVAD3's Avatar
 
Join Date: Aug 2009
Location: Up-Sate NY !
Posts: 79
Send a message via ICQ to DIVAD3
Inserting Table Question???

This post seems fitting to a question I have on inserting a table!
I am inserting this table into a godaddy database:
Quote:
CREATE TABLE IF NOT EXISTS `users` (
`id` bigint(20) NOT NULL auto_increment,
`md5_id` varchar(200) collate latin1_general_ci NOT NULL default '',
`full_name_company_name` tinytext collate latin1_general_ci NOT NULL,
`dealer_tax_id` tinytext collate latin1_general_ci NOT NULL,
`assigned_state_dealer_id` tinytext collate latin1_general_ci NOT NULL,
`street_address` tinytext collate latin1_general_ci NOT NULL,
`state` tinytext collate latin1_general_ci NOT NULL,
`zip_code` tinytext collate latin1_general_ci NOT NULL,
`phone` tinytext collate latin1_general_ci NOT NULL,
`fax` tinytext collate latin1_general_ci NOT NULL,
`website` tinytext collate latin1_general_ci NOT NULL,
`user_name` varchar(200) collate latin1_general_ci NOT NULL default '',
`user_email` varchar(220) collate latin1_general_ci NOT NULL default '',
`pwd` varchar(200) collate latin1_general_ci NOT NULL default '',
`address` text collate latin1_general_ci NOT NULL,
`state` varchar(200) collate latin1_general_ci NOT NULL default '',
`tel` varchar(200) collate latin1_general_ci NOT NULL default '',
`fax` varchar(200) collate latin1_general_ci NOT NULL default '',
`website` text collate latin1_general_ci NOT NULL,
`date` date NOT NULL default '0000-00-00',
`users_ip` varchar(200) collate latin1_general_ci NOT NULL default '',
`approved` int(1) NOT NULL default '0',
`activation_code` int(10) NOT NULL default '0',
`banned` int(1) NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `user_email` (`user_email`),
FULLTEXT KEY `idx_search` (`full_name`,`address`,`user_email`,`user_name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=50 ;
HERE IS A PHOTO SIMILIAR To Go Daddys database:


At the bottom of the database it has only this remaining which is cut off from the diagram which you see: Note: l BOX l = is referring to a box to insert info.
Quote:
TABLE COMMENTS STORAGE COLLATION
l BOX l l BOX l ENGINE
l MYISAM l=drop down l BOX l
BOX
Then it has these notatations as follows:

1 If field type is "enum" or "set", please enter the values using this format: 'a','b','c'...
If you ever need to put a backslash ("\") or a single quote ("'") amongst those values, precede

it with a backslash (for example '\\xyz' or 'a\'b').

2 For default values, please enter just a single value, without backslash escaping or quotes,

using this format: a
-------------------------------------------------------------------------

So my question being this. Where do I enter this bottom portion of the table that starts with:

PRIMARY KEY (`id`),
UNIQUE KEY `user_email` (`user_email`),
FULLTEXT KEY `idx_search` (`full_name`,`address`,`user_email`,`user_name`)
-------------------------------------------------------------------
FROM HERE DOWN It has a place to enter this info:
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=50 ;
------------------------------------------------------------------------
Can anyone tell me where do I insert the bottom portion of this table????

Last edited by DIVAD3; 2010-02-26 at 12:41 PM..
DIVAD3 is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:23 PM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc