Jump to content


ID attributes in edit.php and add.php

form custom

  • Please log in to reply
9 replies to this topic

#1 rafael84

rafael84

    Member

  • Members
  • PipPip
  • 10 posts
  • LocationRio de Janeiro, Brazil

Posted 24 December 2011 - 06:12 PM

Hello guys,

I have just started working with Grocery Crud and am very impressed with the results.
To improve the library, I'd like to suggest some small changes on edit.php and add.php, as follows:

   <div class='form-field-box <?php echo $even_odd?>' id="<?php echo $field->field_name; ?>_field_box">
<div class='form-display-as-box' id="<?php echo $field->field_name; ?>_display_as_box">
<?php echo $input_fields[$field->field_name]->display_as?><?php echo ($input_fields[$field->field_name]->required)? "* " : ""?> :
</div>
<div class='form-input-box' id="<?php echo $field->field_name; ?>_input_box">
<?php echo $input_fields[$field->field_name]->input?>
</div>
<div class='clear'></div>
</div>


The only difference from the original code are the ids:

id="<?php echo $field->field_name; ?>_field_box"
id="<?php echo $field->field_name; ?>_display_as_box"
id="<?php echo $field->field_name; ?>_input_box"

By adding those id attributes we can customize the generated form using CSS.

Check out the sample form I have attached this post.

So, what do you think?

Can it be changed that way?

-Rafael

Attached Thumbnails

  • sample.png


#2 web-johnny

web-johnny

    grocery CRUD Author

  • Administrators
  • 1,101 posts
  • LocationLondon

Posted 25 December 2011 - 08:54 AM

Hello guys,

I have just started working with Grocery Crud and am very impressed with the results.
To improve the library, I'd like to suggest some small changes on edit.php and add.php, as follows:

   <div class='form-field-box <?php echo $even_odd?>' id="<?php echo $field->field_name; ?>_field_box">
<div class='form-display-as-box' id="<?php echo $field->field_name; ?>_display_as_box">
<?php echo $input_fields[$field->field_name]->display_as?><?php echo ($input_fields[$field->field_name]->required)? "* " : ""?> :
</div>
<div class='form-input-box' id="<?php echo $field->field_name; ?>_input_box">
<?php echo $input_fields[$field->field_name]->input?>
</div>
<div class='clear'></div>
</div>


The only difference from the original code are the ids:

id="<?php echo $field->field_name; ?>_field_box"
id="<?php echo $field->field_name; ?>_display_as_box"
id="<?php echo $field->field_name; ?>_input_box"

By adding those id attributes we can customize the generated form using CSS.

Check out the sample form I have attached this post.

So, what do you think?

Can it be changed that way?

-Rafael


Hello Rafael and welcome to grocery CRUD community.

Actually I think it's a pretty good and easy idea. I think I will have it at the next version. Pretty clever and nice view.

If you don't mind, can you please copy the Spanish language and add it to the topic extras and plugins at http://www.grocerycr...coding-plugins/ so everybody can have the opportunity to have the Spanish language file?

Thank you
Posted Image

#3 rafael84

rafael84

    Member

  • Members
  • PipPip
  • 10 posts
  • LocationRio de Janeiro, Brazil

Posted 26 December 2011 - 12:43 AM

Thanks Johnny, I really appreciate your attention to my suggestion.
I just posted my language file, which is actually a Brazilian Portuguese version.
Thankfully someone else has already posted the Spanish translation too.

#4 tareq

tareq

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 25 January 2012 - 11:53 AM

Hi,
This is a very good tric. but I am trying to put ID in <input> tag like <input type='text' name='pnumber' id='bangla' />
any help are welcome.

Thanks,
Tareq

#5 web-johnny

web-johnny

    grocery CRUD Author

  • Administrators
  • 1,101 posts
  • LocationLondon

Posted 25 January 2012 - 07:01 PM

Thanks Johnny, I really appreciate your attention to my suggestion.
I just posted my language file, which is actually a Brazilian Portuguese version.
Thankfully someone else has already posted the Spanish translation too.

@rafael84 sorry I didn't added to this version. I just... forgot it. I stil believe its a good idea and I will added when I have time.
Thanks
Posted Image

#6 web-johnny

web-johnny

    grocery CRUD Author

  • Administrators
  • 1,101 posts
  • LocationLondon

Posted 01 March 2012 - 10:03 PM

@rafael84 I finally include your patch at the new version 1.2 ( https://github.com/s...fcd0319d07705d8 ).

Thanks
Posted Image

#7 naufal

naufal

    Member

  • Members
  • PipPip
  • 18 posts

Posted 13 March 2012 - 02:08 PM

Thank you, i want it too :)

#8 naufal

naufal

    Member

  • Members
  • PipPip
  • 18 posts

Posted 16 March 2012 - 10:27 AM

the new version 1.2 has been released,

now how can i do that like sample form? ty

#9 web-johnny

web-johnny

    grocery CRUD Author

  • Administrators
  • 1,101 posts
  • LocationLondon

Posted 20 March 2012 - 09:59 PM

You just have to add custom CSS with the ids. You will change the width the height e.t.c.
Posted Image

#10 likhon3k

likhon3k

    Advanced Member

  • Members
  • PipPipPip
  • 56 posts

Posted 05 February 2013 - 04:00 AM

Hello guys,

I have just started working with Grocery Crud and am very impressed with the results.
To improve the library, I'd like to suggest some small changes on edit.php and add.php, as follows:

 <div class='form-field-box <?php echo $even_odd?>' id="<?php echo $field->field_name; ?>_field_box">
<div class='form-display-as-box' id="<?php echo $field->field_name; ?>_display_as_box">
<?php echo $input_fields[$field->field_name]->display_as?><?php echo ($input_fields[$field->field_name]->required)? "* " : ""?> :
</div>
<div class='form-input-box' id="<?php echo $field->field_name; ?>_input_box">
<?php echo $input_fields[$field->field_name]->input?>
</div>
<div class='clear'></div>
</div>


The only difference from the original code are the ids:
 

id="<?php echo $field->field_name; ?>_field_box"
id="<?php echo $field->field_name; ?>_display_as_box"
id="<?php echo $field->field_name; ?>_input_box"
By adding those id attributes we can customize the generated form using CSS.

Check out the sample form I have attached this post.

So, what do you think?

Can it be changed that way?

-Rafael

 

can you please give an example how to show two or more input field in one row? I am searching but failed to find out.







Also tagged with one or more of these keywords: form, custom

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users