i want to show the phonenum of the user if it is already entered then the it will show the phonenum - laravel

hi i am trying to show the phone num of the user if it is already entered then the num will show in the input field
<input type="tel" name="phonenum" id="phonenum" #if(isset($user))
{{$user->Phonenum}}
#endif>
i am trying to show it in this manner it is not working any suggestion ??
how can i show the number of the user if it has already been entered by the user .
here in the user table
$table->integer('Phonenum')->nullable();
the field is set in this manner .any suggestion??

Related

Update a cell in Excel Sheet using Power Automate

I'm trying to update the "Email Sent" column once an email has sent. Once an email has been sent I want it to say "Sent" instead of "No"
I'm using the "update a row" action however, can't seem to have it updated. I'm not sure what I should enter for the "Key Value" because email can be sent for multiple rows at once. This is what I have so far but it is not working:
My Excel table:
When you use "Update a row", you need to specify a key column (the one with a unique id or value) so Power Automate can search a single row and update it.
Field "Key Column" is the column name where said ID is stored.
Field "Key Value" is the value to search for.
For example, in the following table:
Mentor ID
Email
Email_Sent
A001
someone#gmail.com
No
A002
someoneelse#gmail.com
No
If you wanted to update the first row, you'd need to specify Key Column = Mentor ID, and Key Value = A001.

Apex Item in interactive report not being displayed correctly

I'm creating a interactive report and I want to dynamically create apex items (text fields) in it, but they are not being displayed correctly.
This is my code:
select
APEX_ITEM.text( p_idx=> 1 , p_value=> null, p_item_id => 'dynamic_item') as "Textfield"
from dual
connect by level = 3;
This shows up in the report:
<input type="text" name="f01" size="20" maxlength="2000" value="" id="dynamic_item" />
But I would like to get the actual item and not the code?
What am I doing wrong?
It looks like you didn't set the escape special characters property to "No".
Go on your report and select the column you created (Textfield).
Then on the right at "Security - Escape special characters" select "No".
Now it should be displayed correctly!

How to create a form that contains data for multiple entities?

I've been trying to think of the best possible way to submit data for multiple entities in a single form.
My use case is that I have a table that contains multiple rows of different entities. I want the ability to go into 'edit' view where some of the columns will become textfields and allow for the value to be changed.
Example
Type | Name | Age
Animal | Eevee | 4
Animal | Sandy | 7
Human | Bob | 24
[Submit]
In edit mode they would be able to change the age for any of the entities. When the user hits save button for the entire list, I want the form to submit all the changes. The problem is that in the update method, I need to know which entities to update with which values
I was thinking of using name attribute to store the entity id of each entity on the input
<input name="{{$entity->id}} value="{{$entity->age}}"></input>
but Animals and Humans are stored in different DB tables. So in the update method of the controller I would have to take the name (which would be the id of the entity) and if it exists as a human
entityToUpdate = Human::find(id)
if entityToUpdate does not exist
entityToUpdate = Animal::find(id)
We use UUIDs in our DB so this would work but it doesn't feel right.
is there a way to group a couple inputs together in a form?
group1
type=animal
id = (Sandys ID)
age = 8
group2
type=human
id =(bobs ID)
age = 25
You could use array notation in your input names in order to get what you want on the server side:
#foreach($entities as $entity)
<input type="hidden" name="group[{{$loop->index}}][type]" value="{{$entity->type}}"/>
<input type="hidden" name="group[{{$loop->index}}][id] value="{{$entity->id}}"/>
<input type="text" name="group[{{$loop->index}}][age] value="{{$entity->age}}"/>
#endforeach
Then on the server side:
foreach(request()->get('group') as $entity) {
// $entity contains ['id'], ['type'], ['age']
}

How to limit character/word count on database string value in Sinatra/Active Record?

I have a column in my ActiveRecord database that I want to have a certain word limit.
Essentially, I've created a form that allows users to enter text(string). I want to limit the amount of characters that are allowed in that string.
#allposts = Post.limit(20)
This is what I have so far in the get method for the /current page that posts all of content. 20 = number of posts shown.
I also have a /new page where users will post new content.
You can limit the number of characters in a few different ways:
1.Defining the limit of the HTML field you create:
<input class="ip-input" id="ip" maxlength="15" name="ip" size="20" type="text" value="0.0.0.0" />
by changing the maxlength attribute. Example taken from here.
2.Using the validates option in the user model:
validates :attribute_you_want_to_limit, length: { maximum: 50 }
You can find more about this option here.
3.Putting a limit in the schema:
t.string :your_attribute, :limit => 20
The first option won't allow the user to input any more in the field, the second won't allow saving the object and the third option won't let the attribute get saved to the database.
I recommend the second option.
You can also use Javascript in a few different ways, here's a good explanation on how to.

saving one object in 2 steps with activerecord

in my user model i have attributes nikname, email, password, and country, about how to register users i want do this in 2 steps :
the first page shows form with 3 fields ( nikname, email, password ) , then user fills them and clicks signup button, and he will be redirected to a second page
the second page shows him a form with the last field ( country ) , then user fills it and clicks finish button to finish his registration
how i can do this ("saving 1 object in 2 step") , and for each step get errors of validation for each form
Maybe this gem https://github.com/schneems/wicked could help you...
Cheers

Resources