Jump to content

changing color of mandatory fields...


visitor

Recommended Posts

Hi there,

 

Does anyone know if it's possible to have mandatory fields (i.e. BUY ISIN is mandatory and therefore this text should change color into red) to show up in a different color? In addition it would be nice to have a text appear like... "fields marked with an asterisk * are mandatory:..."

 

is this something that can be done in PHP5? Has probably anyone got a script...?

 

Cheers,

 

visitor

 

<script>
function SetValues(id,number) 
{
var Ids = new Array(0,
<?php echo $isinCollection->getIdsProperty('id'); ?>
);
var Currency = new Array(0,
<?php echo $isinCollection->getIdsProperty('currency'); ?>
);
var Names = new Array(0,
<?php echo $isinCollection->getIdsProperty('name'); ?>
);
var Nav = new Array(0,
<?php echo $isinCollection->getIdsProperty('nav'); ?>
);
var Date_nav = new Array(0,
<?php echo $isinCollection->getIdsProperty('date_nav'); ?>
);
//alert(number);
if(Ids[id])
if(number=='0'){
  document.getElementById('Currency').value = Currency[id];
  document.getElementById('Name').value = Names[id];
  document.getElementById('NAV').value = Nav[id];
  document.getElementById('Date_NAV').value = Date_nav[id];
  }
if(id==0)
if(number=='0'){
  document.getElementById('Currency').value = 'Select ISIN';
  document.getElementById('Name').value = 'Select ISIN';
  document.getElementById('NAV').value = 'Select ISIN';
  document.getElementById('Date_NAV').value = 'Select ISIN';  
  }
if(Ids[id])
if(number=='1'){
  document.getElementById('Currency2').value = Currency[id];
  document.getElementById('Name2').value = Names[id];
  document.getElementById('NAV2').value = Nav[id];
  document.getElementById('Date_NAV2').value = Date_nav[id];
  }
if(id==0)
if(number=='1'){
  document.getElementById('Currency2').value = 'Select ISIN';
  document.getElementById('Name2').value = 'Select ISIN';
  document.getElementById('NAV2').value = 'Select ISIN';
  document.getElementById('Date_NAV2').value = 'Select ISIN';
  }
}

function verify() 
{
  if((document.getElementById('amount1').value == parseInt(document.getElementById('amount1').value))&&(document.getElementById('amount2').value == parseInt(document.getElementById('amount2').value)))
    document.createT.submit();
  else{
    alert('AMOUNT MUST BE NUMERIC!');	
    return false;}
}
function switc(val) 
{
  document.getElementById('xxx').style.visibility = (val == 'switch') ? 'visible' : 'hidden';
  if(val!='switch')
    document.getElementById('amount2').value='0';

  return true;
}
</script>

<?php //var_dump($result); ?>

<form name='createT' method='post' action='create.php'>
<input type='hidden' name='type' value='<?php echo trim($_REQUEST['type']); ?>'/>
<table width="605px" border="0">
            <tr>
                <td width="120px" align="right">

<?php 
if($_REQUEST['type']=='PURCHASE')
{ 
  echo (CheckForError('BUY ISIN',$result,'BUY ISIN')).'<sup>*</sup>'; 
}
else 
{

  echo (CheckForError('SELL ISIN',$result,'SELL ISIN')).'<sup>*</sup>';
}
?>
                </td>
                <td width="100px">
<select name='security1' onchange='SetValues(this.value,"0")'>
<option value='0'><?php echo 'Select ISIN';?></option>
<?php foreach($isins as $isin){ ?>
<option value='<?php echo $isin['id'];?>' <?php if(trim($_POST['security1']) == $isin['id']) echo"selected = 'selected'" ?>><?php echo $isin['code'];?></option>
<?php } ?>
</select>

                </td>
                <td width="120px" align="right">
                    CURRENCY
                </td>
                <td width="100px">
                    <label>
                        <div class="roundcorner_div">
                            <input type="text" class="roundcorner_textbox" name="Currency" id="Currency" readonly="readonly" <?php echo show('Currency'); ?>/></div>
                    </label>
                </td>
            </tr>
            <tr>
                <td align="right">
                    FUND NAME
                </td>
                <td colspan=3>
                    <label>
                        <div class="roundcorner_div" align="center">
                            <input type="text" name="Name" id="Name" readonly="readonly" size=71 <?php echo show('Name'); ?>/>
</div>
                    </label>
                </td>
            </tr>
            <tr>
                <td width="120px" align="right">
<?php echo CheckForError('Amount or Units',$result,'UNITS').'<sup>*</sup>';  ?>
                </td>
                <td width="100px">
                    <label>
                        <div class="roundcorner_div">
                            <input type="text" class="roundcorner_textbox" name="Units" id="Units" <?php echo show('Units'); ?>/></div>
                    </label>
                </td>
                <td width="120px" align="right">
<?php echo CheckForError('Amount or Units',$result,'AMOUNT').'<sup>*</sup>';  ?>
                </td>
                <td width="100px">
                    <label>
                        <div class="roundcorner_div">
                            <input type="text" class="roundcorner_textbox" name="Amount" id="Amount" <?php echo show('Amount'); ?>/></div>
                    </label>
                </td>
            </tr>
            <tr>
                <td width="120px" align="right">
                    NET ASSET VALUE
                </td>
                <td width="100px">
                    <label>
                        <div class="roundcorner_div">
                            <input type="text" class="roundcorner_textbox" name="NAV" id="NAV" <?php echo show('NAV'); ?>/></div>
                    </label>
                </td>
                <td width="120px" align="right">
                    N.A.V. DATE
                </td>
                <td width="100px">
                    <label>
                        <div class="roundcorner_div">
                            <input type="text" class="roundcorner_textbox" name="Date_NAV" id="Date_NAV" readonly="readonly" <?php echo show('Date_NAV'); ?>/></div>
                    </label>
                </td>
            </tr>

                        
<?php if($_REQUEST['type'] == 'switch'){ ?>
            <tr>
                <td width="120px" align="right"> 
                </td>
                <td width="100px"> 
                </td>
                <td width="120px" align="right"> 
                </td>
                <td width="100px"> 
                </td>
            </tr>

            <tr>
                <td width="120px" align="right">
<?php echo CheckForError('Buy ISIN',$result,'BUY ISIN').'<sup>*</sup>';  ?>

                </td>
                <td width="100px">
<select name='security2' onchange='SetValues(this.value,"1")'>
<option value='0'><?php echo 'Select ISIN';?></option>
<?php foreach($isins as $isin){ ?>
<option value='<?php echo $isin['id'];?>' <?php if(trim($_POST['security2']) == $isin['id']) echo"selected = 'selected'" ?>><?php echo $isin['code'];?></option>
<?php } ?>
</select>

                </td>
                <td width="120px" align="right">
                    CURRENCY
                </td>
                <td width="100px">
                    <label>
                        <div class="roundcorner_div">
                            <input type="text" class="roundcorner_textbox" name="Currency2" id="Currency2" readonly="readonly" <?php echo show('Currency2'); ?>/></div>
                    </label>
                </td>
            </tr>
            <tr>
                <td align="right">
                    FUND NAME
                </td>
                <td colspan=3>
                    <label>
                        <div class="roundcorner_div" align="center">
                            <input type="text" name="Name2" id="Name2" readonly="readonly" size=71 <?php echo show('Name2'); ?>/>
</div>
                    </label>
                </td>
            </tr>
            <tr>
                <td width="120px" align="right">
<?php echo CheckForError('second Amount or Units',$result,'UNITS').'<sup>*</sup>';  ?>
                </td>
                <td width="100px">
                    <label>
                        <div class="roundcorner_div">
                            <input type="text" class="roundcorner_textbox" name="Units2" id="Units2" <?php echo show('Units2'); ?>/></div>
                    </label>
                </td>
                <td width="120px" align="right">
<?php echo CheckForError('second Amount or Units',$result,'AMOUNT').'<sup>*</sup>';  ?>
                </td>
                <td width="100px">
                    <label>
                        <div class="roundcorner_div">
                            <input type="text" class="roundcorner_textbox" name="Amount2" id="Amount2" <?php echo show('Amount2'); ?>/></div>
                    </label>
                </td>
            </tr>
            <tr>
                <td width="120px" align="right">
                    NET ASSET VALUE
                </td>
                <td width="100px">
                    <label>
                        <div class="roundcorner_div">
                            <input type="text" class="roundcorner_textbox" name="NAV2" id="NAV2" <?php echo show('NAV2'); ?>/></div>
                    </label>
                </td>
                <td width="120px" align="right">
                    N.A.V. DATE
                </td>
                <td width="100px">
                    <label>
                        <div class="roundcorner_div">
                            <input type="text" class="roundcorner_textbox" name="Date_NAV2" id="Date_NAV2" readonly="readonly" <?php echo show('Date_NAV2'); ?>/></div>
                    </label>
                </td>
            </tr>


<?php }?>
                        <tr>
                <td width="120px" align="right">
                    CUSTODY A/C
                </td>
                <td width="100px">
<select name='account' >
<?php foreach($accounts as $account){ ?>
<option value='<?php echo $account['id'];?>'><?php echo $account['name'];?></option>
<?php } ?>
</select>

                </td>
            </tr>
            <tr>
                <td width="120px" align="right">
                    FINAL REMARKS
                </td>
                <td width="100px">
                    <label>
                        <div class="roundcorner_div">
                            <input type="text" class="roundcorner_textbox" name="comment" id="Final-Remarks" <?php echo show('comment'); ?>/></div>
                    </label>
                </td>
            </tr>
        </table>
        <br>
<input type='submit' name='button' value='Send' onclick='return verify();'/>
</form>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.