[Mydatabasepilot-cvs] MyDatabasePilot/dbProcessBody AddField.cfm,1.2,1.3
Status: Alpha
Brought to you by:
nanoface
From: <nan...@us...> - 2003-05-29 03:49:46
|
Update of /cvsroot/mydatabasepilot/MyDatabasePilot/dbProcessBody In directory sc8-pr-cvs1:/tmp/cvs-serv15705/dbProcessBody Modified Files: AddField.cfm Log Message: Functionality Added: [ 745318 ] Continued Development of dbProcessBody/AddField.cfm Added Columns: -Field Options -Default Value -Index Added onChange="this.form.submit()" event listeners to: -Number of New Fields Text Box -Location of New Fields Select Box -Field Type Select Boxes The onChange event will reload the form and display any new fields/rows based on new selection Index: AddField.cfm =================================================================== RCS file: /cvsroot/mydatabasepilot/MyDatabasePilot/dbProcessBody/AddField.cfm,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AddField.cfm 27 May 2003 04:15:39 -0000 1.2 --- AddField.cfm 29 May 2003 03:42:06 -0000 1.3 *************** *** 23,27 **** <!---||| Set the default value to the last requested value |||---> <label for="numberOfFields" class="Fancy">Number of New Fields:</label> ! <cfinput name="numberOfFields" type="text" value="#FORM.numberOfFields#" size="2" maxlength="2" range="1,99" required="yes" message="You must enter an interger between 1 and 99 for the number of records field." validate="integer" class="Fancy" /> <br /> --- 23,27 ---- <!---||| Set the default value to the last requested value |||---> <label for="numberOfFields" class="Fancy">Number of New Fields:</label> ! <cfinput name="numberOfFields" type="text" value="#FORM.numberOfFields#" size="2" maxlength="2" range="1,99" required="yes" message="You must enter an interger between 1 and 99 for the number of records field." validate="integer" class="Fancy" onChange="this.form.submit()" /> <br /> *************** *** 29,33 **** <!---||| Set the selected option to the last requested value |||---> <label for="locationOfFields" class="Fancy">Location of New Fields:</label> ! <cfselect name="locationOfFields" size="1" required="yes" class="Fancy"> <!---||| Create options for adding the new field(s) at the beginning and at the end of the current table |||---> <cfif FORM.locationOfFields IS "End"> --- 29,33 ---- <!---||| Set the selected option to the last requested value |||---> <label for="locationOfFields" class="Fancy">Location of New Fields:</label> ! <cfselect name="locationOfFields" size="1" required="yes" class="Fancy" onChange="this.form.submit()"> <!---||| Create options for adding the new field(s) at the beginning and at the end of the current table |||---> <cfif FORM.locationOfFields IS "End"> *************** *** 62,66 **** <td><label class="Fancy">Field Name:</label></td> <td><label class="Fancy">Field Type:</label></td> ! </tr> --- 62,68 ---- <td><label class="Fancy">Field Name:</label></td> <td><label class="Fancy">Field Type:</label></td> ! <td><label class="Fancy">Field Options:</label></td> ! <td><label class="Fancy">Default Value:</label></td> ! <td><label class="Fancy">Index:</label></td> </tr> *************** *** 72,116 **** <!--- Print Row Number ---> <td><label class="Fancy">#i#</label></td> ! <!--- Allow User to Specify the Fields Name ---> ! <!---***Add validate="regular_expression" to above, to ensure user entered a valid field name***---> ! <td><cfinput name="fieldName#i#" type="text" value="" size="40" required="yes" message="You must enter a valid field name for New Field number #i#." class="Fancy" /></td> ! <!--- Allow User to Select Field Type ---> <td> ! <cfselect name="fieldType#i#" size="1" required="yes" class="Fancy"> ! <option value="Empty" selected class="Fancy"></option> <optgroup label="String" class="Fancy"> ! <option value="VARCHAR" class="Fancy">VARCHAR(m)</option> ! <option value="CHAR" class="Fancy">CHAR(m)</option> ! <option value="TINYBLOB" class="Fancy">TINYBLOB</option> ! <option value="BLOB" class="Fancy">BLOB</option> ! <option value="MEDIUMBLOB" class="Fancy">MEDIUMBLOB</option> ! <option value="LONGBLOB" class="Fancy">LONGBLOB</option> ! <option value="TINYTEXT" class="Fancy">TINYTEXT</option> ! <option value="TEXT" class="Fancy">TEXT</option> ! <option value="MEDIUMTEXT" class="Fancy">MEDIUMTEXT</option> ! <option value="LONGTEXT" class="Fancy">LONGTEXT</option> ! <option value="ENUM" class="Fancy">ENUM(v1,v2,...)</option> ! <option value="SET" class="Fancy">SET(v1,v2,...)</option> </optgroup> <optgroup label="Numeric" class="Fancy"> ! <option value="TINYINT" class="Fancy">TINYINT(m)</option> ! <option value="SMALLINT" class="Fancy">SMALLINT(m)</option> ! <option value="MEDIUMINT" class="Fancy">MEDIUMINT(m)</option> ! <option value="INT" class="Fancy">INT(m)</option> ! <option value="BIGINT" class="Fancy">BIGINT(m)</option> ! <option value="FLOAT" class="Fancy">FLOAT(m,d)</option> ! <option value="DOUBLE" class="Fancy">DOUBLE(m,d)</option> ! <option value="DECIMAL" class="Fancy">DECIMAL(m,d)</option> </optgroup> <optgroup label="Date Time" class="Fancy"> ! <option value="DATE" class="Fancy">DATE</option> ! <option value="TIME" class="Fancy">TIME</option> ! <option value="DATETIME" class="Fancy">DATETIME</option> ! <option value="YEAR" class="Fancy">YEAR</option> ! <option value="TIMESTAMP" class="Fancy">TIMESTAMP(m)</option> </optgroup> </cfselect> </td> </tr> </cfoutput> --- 74,340 ---- <!--- Print Row Number ---> <td><label class="Fancy">#i#</label></td> ! ! <!---||| Allow User to Specify the Fields Name |||---> ! <!--- Set a default value of empty string ---> ! <cfparam name="FORM.fieldName#i#" default="" /> ! <!--- If the form has been resubmitted by an onChange event than the original values for this form will be used ---> ! <!---***Add validate="regular_expression" to below, to ensure user entered a valid field name***---> ! <td><cfinput name="fieldName#i#" type="text" value="#Evaluate("FORM.fieldName#i#")#" size="20" maxlength="64" required="yes" message="You must enter a valid field name for New Field number #i#." class="Fancy" /></td> ! ! <!---||| Allow User to Select Field Type |||---> ! <!--- Set a default value of empty string ---> ! <cfparam name="FORM.fieldType#i#" default="" /> <td> ! <cfselect name="fieldType#i#" size="1" required="yes" class="Fancy" onChange="this.form.submit()"> ! <!--- Check to see if empty option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS ""> ! <option value="Empty" selected class="Fancy"></option> ! <cfelse> ! <option value="Empty" class="Fancy"></option> ! </cfif> <optgroup label="String" class="Fancy"> ! <!--- Check to see if VARCHAR option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "VARCHAR"> ! <option value="VARCHAR" selected class="Fancy">VARCHAR(m)</option> ! <cfelse> ! <option value="VARCHAR" class="Fancy">VARCHAR(m)</option> ! </cfif> ! ! <!--- Check to see if CHAR option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "CHAR"> ! <option value="CHAR" selected class="Fancy">CHAR(m)</option> ! <cfelse> ! <option value="CHAR" class="Fancy">CHAR(m)</option> ! </cfif> ! ! <!--- Check to see if TINYBLOB option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "TINYBLOB"> ! <option value="TINYBLOB" selected class="Fancy">TINYBLOB</option> ! <cfelse> ! <option value="TINYBLOB" class="Fancy">TINYBLOB</option> ! </cfif> ! ! <!--- Check to see if BLOB option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "BLOB"> ! <option value="BLOB" selected class="Fancy">BLOB</option> ! <cfelse> ! <option value="BLOB" class="Fancy">BLOB</option> ! </cfif> ! ! <!--- Check to see if MEDIUMBLOB option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "MEDIUMBLOB"> ! <option value="MEDIUMBLOB" selected class="Fancy">MEDIUMBLOB</option> ! <cfelse> ! <option value="MEDIUMBLOB" class="Fancy">MEDIUMBLOB</option> ! </cfif> ! ! <!--- Check to see if LONGBLOB option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "LONGBLOB"> ! <option value="LONGBLOB" selected class="Fancy">LONGBLOB</option> ! <cfelse> ! <option value="LONGBLOB" class="Fancy">LONGBLOB</option> ! </cfif> ! ! <!--- Check to see if TINYTEXT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "TINYTEXT"> ! <option value="TINYTEXT" selected class="Fancy">TINYTEXT</option> ! <cfelse> ! <option value="TINYTEXT" class="Fancy">TINYTEXT</option> ! </cfif> ! ! <!--- Check to see if TEXT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "TEXT"> ! <option value="TEXT" selected class="Fancy">TEXT</option> ! <cfelse> ! <option value="TEXT" class="Fancy">TEXT</option> ! </cfif> ! ! <!--- Check to see if MEDIUMTEXT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "MEDIUMTEXT"> ! <option value="MEDIUMTEXT" selected class="Fancy">MEDIUMTEXT</option> ! <cfelse> ! <option value="MEDIUMTEXT" class="Fancy">MEDIUMTEXT</option> ! </cfif> ! ! <!--- Check to see if LONGTEXT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "LONGTEXT"> ! <option value="LONGTEXT" selected class="Fancy">LONGTEXT</option> ! <cfelse> ! <option value="LONGTEXT" class="Fancy">LONGTEXT</option> ! </cfif> ! ! <!--- Check to see if ENUM option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "ENUM"> ! <option value="ENUM" selected class="Fancy">ENUM(v1,v2,...)</option> ! <cfelse> ! <option value="ENUM" class="Fancy">ENUM(v1,v2,...)</option> ! </cfif> ! ! <!--- Check to see if SET option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "SET"> ! <option value="SET" selected class="Fancy">SET(v1,v2,...)</option> ! <cfelse> ! <option value="SET" class="Fancy">SET(v1,v2,...)</option> ! </cfif> </optgroup> <optgroup label="Numeric" class="Fancy"> ! <!--- Check to see if TINYINT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "TINYINT"> ! <option value="TINYINT" selected class="Fancy">TINYINT(m)</option> ! <cfelse> ! <option value="TINYINT" class="Fancy">TINYINT(m)</option> ! </cfif> ! ! <!--- Check to see if SMALLINT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "SMALLINT"> ! <option value="SMALLINT" selected class="Fancy">SMALLINT(m)</option> ! <cfelse> ! <option value="SMALLINT" class="Fancy">SMALLINT(m)</option> ! </cfif> ! ! <!--- Check to see if MEDIUMINT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "MEDIUMINT"> ! <option value="MEDIUMINT" selected class="Fancy">MEDIUMINT(m)</option> ! <cfelse> ! <option value="MEDIUMINT" class="Fancy">MEDIUMINT(m)</option> ! </cfif> ! ! <!--- Check to see if INT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "INT"> ! <option value="INT" selected class="Fancy">INT(m)</option> ! <cfelse> ! <option value="INT" class="Fancy">INT(m)</option> ! </cfif> ! ! <!--- Check to see if BIGINT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "BIGINT"> ! <option value="BIGINT" selected class="Fancy">BIGINT(m)</option> ! <cfelse> ! <option value="BIGINT" class="Fancy">BIGINT(m)</option> ! </cfif> ! ! <!--- Check to see if FLOAT option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "FLOAT"> ! <option value="FLOAT" selected class="Fancy">FLOAT(m,d)</option> ! <cfelse> ! <option value="FLOAT" class="Fancy">FLOAT(m,d)</option> ! </cfif> ! ! <!--- Check to see if DOUBLE option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "DOUBLE"> ! <option value="DOUBLE" selected class="Fancy">DOUBLE(m,d)</option> ! <cfelse> ! <option value="DOUBLE" class="Fancy">DOUBLE(m,d)</option> ! </cfif> ! ! <!--- Check to see if DECIMAL option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "DECIMAL"> ! <option value="DECIMAL" selected class="Fancy">DECIMAL(m,d)</option> ! <cfelse> ! <option value="DECIMAL" class="Fancy">DECIMAL(m,d)</option> ! </cfif> </optgroup> <optgroup label="Date Time" class="Fancy"> ! <!--- Check to see if DATE option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "DATE"> ! <option value="DATE" selected class="Fancy">DATE</option> ! <cfelse> ! <option value="DATE" class="Fancy">DATE</option> ! </cfif> ! ! <!--- Check to see if TIME option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "TIME"> ! <option value="TIME" selected class="Fancy">TIME</option> ! <cfelse> ! <option value="TIME" class="Fancy">TIME</option> ! </cfif> ! ! <!--- Check to see if DATETIME option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "DATETIME"> ! <option value="DATETIME" selected class="Fancy">DATETIME</option> ! <cfelse> ! <option value="DATETIME" class="Fancy">DATETIME</option> ! </cfif> ! ! <!--- Check to see if YEAR option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "YEAR"> ! <option value="YEAR" selected class="Fancy">YEAR</option> ! <cfelse> ! <option value="YEAR" class="Fancy">YEAR</option> ! </cfif> ! ! <!--- Check to see if TIMESTAMP option was selected, and reselect it accordingly ---> ! <cfif Evaluate("FORM.fieldType#i#") IS "TIMESTAMP"> ! <option value="TIMESTAMP" selected class="Fancy">TIMESTAMP(m)</option> ! <cfelse> ! <option value="TIMESTAMP" class="Fancy">TIMESTAMP(m)</option> ! </cfif> </optgroup> </cfselect> </td> + <!---||| Allow User to Enter Field Options |||---> + <!--- Set a default values of empty string ---> + <cfparam name="FORM.length#i#" default="" /> + <cfparam name="FORM.displayWidth#i#" default="" /> + <cfparam name="FORM.autoIncrement#i#" default="" /> + <cfparam name="FORM.unsigned#i#" default="" /> + <cfparam name="FORM.zerofill#i#" default="" /> + <cfparam name="FORM.notNull#i#" default="" /> + <cfparam name="FORM.binary#i#" default="" /> + <td valign="middle"> + <!---||| Show Available Field Options Based on Selected Field Type |||---> + <cfswitch expression="#Evaluate("FORM.fieldType#i#")#"> + <cfcase value="VARCHAR,CHAR"> + <nobr><label class="Fancy">Length(</label><cfinput name="length#i#" type="text" value="#Evaluate("FORM.length#i#")#" size="3" maxlength="3" range="0,255" required="yes" message="The legal range for length is 0-255. Please correct this field for row number #i#." validate="integer" class="Fancy" /><label class="Fancy">)</label></nobr><br /> + <nobr><cfinput name="binary#i#" type="checkbox" /><label for="binary#i#" class="Fancy">BINARY</label></nobr><br /> + <nobr><cfinput name="notNull#i#" type="checkbox" /><label for="notNull#i#" class="Fancy">NOT NULL</label></nobr> + </cfcase> + <cfcase value="TINYBLOB,BLOB,MEDIUMBLOB,LONGBLOB,TINYTEXT,TEXT,MEDIUMTEXT,LONGTEXT"> + <nobr><cfinput name="notNull#i#" type="checkbox" /><label for="notNull#i#" class="Fancy">NOT NULL</label></nobr> + </cfcase> + <cfcase value="ENUM,SET"> + Enum,Set: Needs to be developped<br /> + <nobr><cfinput name="notNull#i#" type="checkbox" /><label for="notNull#i#" class="Fancy">NOT NULL</label></nobr> + </cfcase> + <cfcase value="TINYINT,SMALLINT,MEDIUMINT,INT,BIGINT"> + <nobr><label class="Fancy">Display Width(</label><cfinput name="displayWidth#i#" type="text" value="#Evaluate("FORM.displayWidth#i#")#" size="2" maxlength="2" range="1,20" message="The legal range for Display Width is 1-20. Please correct this field for row number #i#." validate="integer" class="Fancy" /><label class="Fancy">)</label></nobr><br /> + <nobr><cfinput name="autoIncrement#i#" type="checkbox" /><label for="autoIncrement#i#" class="Fancy">AUTO_INCREMENT</label></nobr><br /> + <nobr><cfinput name="unsigned#i#" type="checkbox" /><label for="unsigned#i#" class="Fancy">UNSIGNED</label></nobr><br /> + <nobr><cfinput name="zerofill#i#" type="checkbox" /><label for="zerofill#i#" class="Fancy">ZEROFILL</label></nobr><br /> + <nobr><cfinput name="notNull#i#" type="checkbox" /><label for="notNull#i#" class="Fancy">NOT NULL</label></nobr> + </cfcase> + <cfcase value="FLOAT,DOUBLE,DECIMAL"> + FLOAT,DOUBLE,DECIMAL: Needs to be developped<br /> + <nobr><cfinput name="notNull#i#" type="checkbox" /><label for="notNull#i#" class="Fancy">NOT NULL</label></nobr> + </cfcase> + <cfcase value="DATE,TIME,DATETIME,YEAR,TIMESTAMP"> + DATE,TIME,DATETIME,YEAR,TIMESTAMP: Needs to be developped<br /> + <nobr><cfinput name="notNull#i#" type="checkbox" /><label for="notNull#i#" class="Fancy">NOT NULL</label></nobr> + </cfcase> + <cfdefaultcase><label class="Fancy">Select a Field Type to see Field Options</label></cfdefaultcase> + </cfswitch> + </td> + + <!---||| Allow User to Enter a Default Value for the Field Unless fieldType is BLOB or TEXT |||---> + <td> + <cfswitch expression="#Evaluate("FORM.fieldType#i#")#"> + <cfcase value="TINYBLOB,BLOB,MEDIUMBLOB,LONGBLOB,TINYTEXT,TEXT,MEDIUMTEXT,LONGTEXT"> + <label class="Fancy">BLOB and TEXT field types can not have default values.</label> + </cfcase> + <cfdefaultcase><cfinput name="default#i#" value="#Evaluate("FORM.default#i#")#" type="text" size="20" required="no" class="Fancy" /></cfdefaultcase> + </cfswitch> + + + </td> + + <!---||| Allow User to Specify a Single Column Index |||---> + <td> + Primary + Index + Unique + None + Fulltext + </td> </tr> </cfoutput> |